move some scripts to devel subfolder
This commit is contained in:
parent
284a454a9a
commit
74d8beff3a
8 changed files with 0 additions and 0 deletions
66
devel/dmjavadoc
Executable file
66
devel/dmjavadoc
Executable file
|
@ -0,0 +1,66 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'dmenu'
|
||||
|
||||
JAVA_DOC_LOCATION = "/usr/share/doc/api"
|
||||
JAVAFX_DOC_LOCATION = "/usr/share/doc/javafx-sdk-docs-*"
|
||||
|
||||
USER_DOC_LOCATION = (ENV['XDG_DATA_HOME'] || ENV['HOME'] + '/.local/share') + '/javadoc/*'
|
||||
|
||||
class DocIndex
|
||||
attr_reader :items
|
||||
|
||||
def initialize(path)
|
||||
@items = []
|
||||
find_entries(path)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def gen_candidates(dir)
|
||||
Dir.entries(dir).reject {|e| e == '.' ||
|
||||
e == '..' ||
|
||||
e == 'class-use' ||
|
||||
e == 'src-html' ||
|
||||
(e =~ /^[a-z].*\..*/ && e != 'package-summary.html')}
|
||||
end
|
||||
|
||||
def find_entries(dir, path = [])
|
||||
candidates = gen_candidates(dir)
|
||||
candidates.each do |entry|
|
||||
if entry == "package-summary.html"
|
||||
@items << Dmenu::Item.new(path.join(?.), dir + ?/ + entry)
|
||||
elsif entry.end_with? ".html"
|
||||
@items << Dmenu::Item.new(
|
||||
path.join(?.) + ?. + File.basename(entry, '.html'),
|
||||
dir + ?/ + entry
|
||||
)
|
||||
elsif File.directory?(dir + ?/ + entry)
|
||||
find_entries(dir + ?/ + entry, path + [entry])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
user_libs = Dir.glob(USER_DOC_LOCATION)
|
||||
java_folder = Dir.glob(JAVA_DOC_LOCATION).last
|
||||
jfx_folder = Dir.glob(JAVAFX_DOC_LOCATION).last + "/html"
|
||||
|
||||
|
||||
libmenu = Dmenu.new
|
||||
libmenu.items = [
|
||||
Dmenu::Item.new("Java Standard Library (std)", java_folder),
|
||||
Dmenu::Item.new("javafx", jfx_folder)
|
||||
] + user_libs.map{|f| Dmenu::Item.new(File.basename(f), f)}
|
||||
|
||||
libmenu.case_insensitive = true
|
||||
libmenu.prompt = "Library:"
|
||||
libmenu.lines = 20
|
||||
|
||||
menu = Dmenu.new
|
||||
menu.items = DocIndex.new(libmenu.run.value).items
|
||||
menu.case_insensitive = true
|
||||
menu.prompt = "Javadoc:"
|
||||
menu.lines = 20
|
||||
system("xdg-open #{menu.run.value}")
|
52
devel/dmscaladoc
Executable file
52
devel/dmscaladoc
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'dmenu'
|
||||
|
||||
JAVA_DOC_LOCATION = "/home/crater2150/manuals/scala-*"
|
||||
|
||||
USER_DOC_LOCATION = (ENV['XDG_DATA_HOME'] || ENV['HOME'] + '/.local') + '/scaladoc/*'
|
||||
|
||||
class DocIndex
|
||||
attr_reader :items
|
||||
|
||||
def initialize(path)
|
||||
@items = []
|
||||
find_entries(path)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def gen_candidates(dir)
|
||||
Dir.entries(dir).reject {|e| e == '.' ||
|
||||
e == '..' ||
|
||||
e == 'class-use' ||
|
||||
e == 'src-html' ||
|
||||
(e =~ /^[a-z].*\..*/ && e != 'package-summary.html')}
|
||||
end
|
||||
|
||||
def find_entries(dir, path = [])
|
||||
candidates = gen_candidates(dir)
|
||||
candidates.each do |entry|
|
||||
if entry == "package-summary.html"
|
||||
@items << Dmenu::Item.new(path.join(?.), dir + ?/ + entry)
|
||||
elsif entry.end_with? ".html"
|
||||
@items << Dmenu::Item.new(
|
||||
path.join(?.) + ?. + File.basename(entry, '.html'),
|
||||
dir + ?/ + entry
|
||||
)
|
||||
elsif File.directory?(dir + ?/ + entry)
|
||||
find_entries(dir + ?/ + entry, path + [entry])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
scala_folder = Dir.glob(JAVA_DOC_LOCATION).last + "/api/scala-library/"
|
||||
|
||||
menu = Dmenu.new
|
||||
menu.items = DocIndex.new(scala_folder).items
|
||||
menu.case_insensitive = true
|
||||
menu.prompt = "Javadoc:"
|
||||
menu.lines = 20
|
||||
system("xdg-open #{menu.run.value}")
|
17
devel/dmtexdoc
Executable file
17
devel/dmtexdoc
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/zsh
|
||||
zparseopts -D -E -help=help h=help -update=update u=update
|
||||
|
||||
CACHE_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/dtexdoc.list"
|
||||
SOURCES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/dmtexdoc/sources"
|
||||
|
||||
if [[ -n "$help" ]]; then
|
||||
echo "Usage: $0 [-u|--update]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$update" || ! -e "$CACHE_FILE" ]]; then
|
||||
find -L ${$(which texdoc):h:h:h}/texmf-dist/doc/ "${(@f)$(<$SOURCES_FILE)}" \
|
||||
-iname '*.pdf' -printf "%f\n" \
|
||||
| sed -e 's/\..*//' | sort | uniq > $CACHE_FILE
|
||||
fi
|
||||
texdoc $(dmenu < $CACHE_FILE)
|
21
devel/idea
Executable file
21
devel/idea
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/zsh
|
||||
unset JAVA_HOME
|
||||
source /etc/profile.d/11_oracle-jdk.sh
|
||||
export IBUS_ENABLE_SYNC_MODE=1
|
||||
export XMODIFIERS=""
|
||||
|
||||
dotfiles=( $HOME/.* )
|
||||
project_dirs=(
|
||||
$HOME/learning
|
||||
$HOME/teaching
|
||||
$HOME/projects
|
||||
$HOME/sandbox
|
||||
$HOME/sources
|
||||
$HOME/toy-projects
|
||||
$HOME/work
|
||||
)
|
||||
|
||||
exec firejail \
|
||||
--whitelist=${^dotfiles} \
|
||||
--whitelist=${^project_dirs} \
|
||||
$(ls ${XDG_DATA_HOME:-~/.local/share}/idea-IU-*/bin/idea.sh | sort | tail -n 1)
|
20
devel/ipy
Executable file
20
devel/ipy
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/zsh
|
||||
|
||||
if [[ -n $VIRTUAL_ENV ]]; then
|
||||
pip install ipython &>/dev/null
|
||||
else
|
||||
cd ~/toy-projects/playground_venv/
|
||||
. bin/activate
|
||||
fi
|
||||
|
||||
if [[ -e $VIRTUAL_ENV/ipython_profile ]]; then
|
||||
ipy_profile="--profile=$(<$VIRTUAL_ENV/ipython_profile)"
|
||||
fi
|
||||
|
||||
if [[ "$1" == "pip" ]]; then
|
||||
exec "$@"
|
||||
elif [[ $1 == "-s" ]]; then
|
||||
exec $SHELL
|
||||
else
|
||||
exec ipython $ipy_profile "$@"
|
||||
fi
|
13
devel/mkscript
Executable file
13
devel/mkscript
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/zsh
|
||||
BINDIR=$HOME/.local/bin
|
||||
if [[ -e $BINDIR/$1 ]]; then
|
||||
echo Script $1 exists, opening for edit
|
||||
$EDITOR $BINDIR/$1
|
||||
else
|
||||
touch $BINDIR/$1
|
||||
chmod a+x $BINDIR/$1
|
||||
echo "#!$SHELL" >> $BINDIR/$1
|
||||
$EDITOR $BINDIR/$1
|
||||
exit 0
|
||||
fi
|
||||
|
74
devel/pomdep-graph
Executable file
74
devel/pomdep-graph
Executable file
|
@ -0,0 +1,74 @@
|
|||
#!/bin/zsh
|
||||
|
||||
zparseopts -D -K -E h=help -help=help -renderer:=renderer r:=renderer \
|
||||
f:=filter -filter:=filter \
|
||||
o:=output -output:=output \
|
||||
l:=leaf_color -leaf-color:=leaf_color \
|
||||
G=graph_only -graph-only=graph_only
|
||||
|
||||
renderer=${renderer[2]:-dot}
|
||||
output=${output[2]:-deps.png}
|
||||
leaf_color=${leaf_color[2]:-green}
|
||||
|
||||
if [[ $output == "-" ]]; then output=/dev/stdout; fi
|
||||
if [[ -n $graph_only ]]; then
|
||||
renderer=cat
|
||||
output=/dev/stdout
|
||||
fi
|
||||
|
||||
if [[ -z "$2" ]]; then
|
||||
echo "Usage: $0 [options] POM_FILE..."
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -f, --filter=TEXT only show dependencies with TEXT in their group id"
|
||||
echo " -r, --renderer=PROGRAM use PROGRAM for rendering. May contain additional parameters"
|
||||
echo " e.g. -r \"dot -Goverlap=false\""
|
||||
echo " default: dot -Tpng"
|
||||
echo " -o, --output=FILE output to FILE, defaults to deps.png"
|
||||
echo " -l, --leaf-color=COLOR color of leaf nodes (packages without dependencies)"
|
||||
echo " -G, --graph-only output unlayouted graph code, overrides -r and -o"
|
||||
echo " equivalent to \"-r cat -o /dev/stdout\""
|
||||
|
||||
fi
|
||||
|
||||
if [[ -n $filter ]]; then
|
||||
DEP_PATH="//dependencies//groupId[contains(text(),'${filter[2]}')]/following-sibling::artifactId/text()"
|
||||
else
|
||||
DEP_PATH="//dependencies//groupId/following-sibling::artifactId/text()"
|
||||
fi
|
||||
|
||||
PKG_PATH="/project/artifactId/text()"
|
||||
|
||||
xpath() {
|
||||
xmllint --shell <(sed -e "s/xmlns=/ignore=/" $2) <<<"cat $1" | grep -v '^\(/ >\| --\)'
|
||||
}
|
||||
|
||||
remove-disconnected() {
|
||||
gvpr -c "N[$.degree==0]{delete(NULL, $)}" "$@"
|
||||
}
|
||||
|
||||
color-leaf-deps() {
|
||||
gvpr -c "N[$.outdegree==0]{$.color ='$1'}"
|
||||
}
|
||||
|
||||
graph-from-poms() {
|
||||
echo 'digraph deps {'
|
||||
|
||||
for pom in "$@"; do
|
||||
pkg=$(xpath $PKG_PATH $pom)
|
||||
deps=($(xpath $DEP_PATH $pom | grep '^[a-zA-Z]'))
|
||||
|
||||
echo " \"$pkg\""
|
||||
for i in $deps; do
|
||||
echo " \"$pkg\" -> \"$i\""
|
||||
done
|
||||
done
|
||||
|
||||
echo '}'
|
||||
}
|
||||
|
||||
render() {
|
||||
$=renderer > $output
|
||||
}
|
||||
|
||||
graph-from-poms "$@" | remove-disconnected | color-leaf-deps $leaf_color | render
|
13
devel/update-amm
Executable file
13
devel/update-amm
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/zsh
|
||||
versions=$(curl -L https://api.github.com/repos/lihaoyi/Ammonite/releases/latest)
|
||||
|
||||
download-version() {
|
||||
(
|
||||
echo "#/usr/bin/env python --version sh" && \
|
||||
curl -L $( echo $versions \
|
||||
| jq -r ".assets | map(select(.name | startswith(\"$1\")))[0].browser_download_url")
|
||||
) > $2
|
||||
chmod +x $2
|
||||
}
|
||||
download-version 2.13 $(which amm)
|
||||
download-version 2.12 $(which amm)2.12
|
Loading…
Add table
Add a link
Reference in a new issue