Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'scanf' | ||
|
||
plugins = [ | ||
"clojure", | ||
"crystal", | ||
"dart", | ||
"erlang", | ||
"elixir", | ||
"elm", | ||
"golang", | ||
"haskell", | ||
# "java", | ||
"kotlin", | ||
"kubectl", | ||
"minikube", | ||
"nodejs", | ||
"protoc", | ||
"python", | ||
"ruby", | ||
"rust", | ||
] | ||
|
||
def fill(arr, len, fill_value) | ||
len.times do |i| | ||
if arr[i].nil? | ||
arr[i] = fill_value | ||
end | ||
end | ||
arr | ||
end | ||
|
||
def sem_ver(version_str) | ||
major, minor, patch = version_str.scanf("%d.%d.%d") | ||
fill([major, minor, patch], 3, 0) | ||
end | ||
|
||
def greater_version(a, b) | ||
return -1 if a == 'stable' | ||
return 1 if b == 'stable' | ||
|
||
a_major, a_minor, a_patch = sem_ver(a) | ||
b_major, b_minor, b_patch = sem_ver(b) | ||
|
||
return -1 if a_major > b_major | ||
return 1 if a_major < b_major | ||
|
||
return -1 if a_minor > b_minor | ||
return 1 if a_minor < b_minor | ||
|
||
return -1 if a_patch > b_patch | ||
return 1 if a_patch < b_patch | ||
|
||
0 | ||
end | ||
|
||
def install_plugin(plugin) | ||
`asdf plugin-add #{plugin}` | ||
sorted_versions = | ||
`asdf list-all #{plugin}` | ||
.split("\n") | ||
.grep(/^(\d+(\.\d+){1,2}|stable)$/) | ||
.sort { |a, b| greater_version(a, b) } | ||
|
||
if sorted_versions.empty? | ||
puts "could not find versions for #{plugin}" | ||
else | ||
latest_version = sorted_versions[0] | ||
puts "installing #{plugin}: #{latest_version}" | ||
`asdf install #{plugin} #{latest_version}` | ||
puts "setting asdf global #{plugin} #{latest_version}" | ||
`asdf global #{plugin} #{latest_version}` | ||
end | ||
end | ||
|
||
plugins.each { |p| install_plugin(p) } | ||
|
||
puts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
awk 'BEGIN{ | ||
s="/\\/\\/\\/\\/\\"; s=s s s s s s s s; | ||
for (colnum = 0; colnum<77; colnum++) { | ||
r = 255-(colnum*255/76); | ||
g = (colnum*510/76); | ||
b = (colnum*255/76); | ||
if (g>255) g = 510-g; | ||
printf "\033[48;2;%d;%d;%dm", r,g,b; | ||
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b; | ||
printf "%s\033[0m", substr(s,colnum+1,1); | ||
} | ||
printf "\n"; | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{- if eq .chezmoi.os "linux" }} | ||
#!/bin/bash | ||
|
||
res=$(echo "lock|logout|reboot|shutdown|hibernate" | rofi -sep "|" -dmenu -i -p 'Power Menu: ' "" -width 9 -l 5 -hide-scrollbar -eh 4 -location 3 -yoffset 20 -padding 12 -opacity 100 -font "Misc Tamsyn 9" -auto-select -no-fullscreen) | ||
|
||
if [ $res = "lock" ]; then | ||
/usr/local/bin/lock.sh | ||
fi | ||
|
||
if [ $res = "logout" ]; then | ||
i3-msg exit | ||
fi | ||
|
||
if [ $res = "reboot" ]; then | ||
systemctl reboot | ||
fi | ||
|
||
if [ $res = "shutdown" ]; then | ||
systemctl poweroff | ||
fi | ||
|
||
if [ $res = "hibernate" ]; then | ||
systemctl hibernate | ||
fi | ||
exit 0 | ||
{{- end }} |