summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTslil Clingman <hiato1@gmail.com>2013-03-26 15:19:47 +0200
committerTslil Clingman <hiato1@gmail.com>2013-03-26 15:19:47 +0200
commit8c19617946822d7aeac61696294f893d5e5eca6f (patch)
treec4df5faffc6b335b2c48e2fadd7d6125a33a6056
Init scripts
-rwxr-xr-xaur28
-rwxr-xr-xci27
-rwxr-xr-xd11
-rwxr-xr-xm33
-rwxr-xr-xranpas26
-rwxr-xr-xsc12
-rwxr-xr-xwls25
7 files changed, 162 insertions, 0 deletions
diff --git a/aur b/aur
new file mode 100755
index 0000000..c95c113
--- /dev/null
+++ b/aur
@@ -0,0 +1,28 @@
+#!/bin/sh
+if [ "$1" = "-s" ]; then
+ echo Searching for "$2" ...
+ echo
+ echo -e "$(wget -q "https://aur.archlinux.org/rpc.php?type=search&arg=$2" -O - | tr '{:' '\n ' | grep Name | sed 's/.*,"Name"\ "\(.*\)","Version"\ "\([0-9.-]*\).*,"Description"\ "\(.*\)","URL".*/\1 \2\n \3\n/')"
+ exit
+fi;
+
+cd prog/aur
+
+echo Pulling...
+wget "https://aur.archlinux.org/packages/`echo $1|cut -b 1-2`/$1/$1.tar.gz"
+if [ -f "$1.tar.gz" ]; then
+ echo Extracting...
+ tar -xf "$1.tar.gz"
+ cd "$1"
+ mv ../"$1.tar.gz" .
+ echo -n Edit\?\
+ read edit
+ [ "$edit" = "y" ] && $EDITOR PKGBUILD
+ echo Building...
+ makepkg -f
+ if [ "$?" = "0" ]; then
+ name=$1"-`sed -n 's/pkgver=//p' PKGBUILD`-`sed -n 's/pkgrel=//p' PKGBUILD`"
+ echo Installing...
+ sudo pacman -U $name*.xz
+ fi;
+fi;
diff --git a/ci b/ci
new file mode 100755
index 0000000..32c828b
--- /dev/null
+++ b/ci
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+LIBR="stdlib stdio math ieee754"
+FLAG="-Wall -lm"
+
+NAME=/tmp/$RANDOM-$RANDOM
+SRC=$NAME.c
+BIN=$NAME-B
+
+for k in $LIBR; do
+ echo "#include<$k.h>" >> $SRC
+done
+
+echo "int main(int argc, char ** argv) {" >> $SRC
+cat - >> $SRC
+echo "return 0; }" >> $SRC
+
+echo -e "\n\n\t!!! Compiling ..."
+gcc $FLAG $SRC -o $BIN
+
+if [ "$?" = "0" ]; then
+ echo -e "\t!!! Executing ...\n\n"
+ exec $BIN
+ rm $BIN
+fi;
+
+rm $SRC
diff --git a/d b/d
new file mode 100755
index 0000000..774e969
--- /dev/null
+++ b/d
@@ -0,0 +1,11 @@
+#!/bin/bash
+[ "$1" = "$HOME" ] && echo $HOME && exit
+fl="$HOME/.local/share/dir_lst";[ ! -f "$fl" ] && touch "$fl"
+[ "$2" = "!" ] && echo "$1" && exit || \
+ln=`grep -n "$1" "$fl" | head -n 1 | cut -d : -f 1`
+if [ ! "$1" = "" ]; then if [ ! "$ln" = "" ]; then
+echo -e "$ln m0\n1p\nw"|ed -s "$fl"||echo \?; else
+l=$1; while [ ! -d "$l" ]; do echo \?; read l; done;
+l=`echo "$l" | sed "s|^[^/]|$PWD/&|"`;
+echo -e "0i\n$l\n.\n1p\nw" | ed -s "$fl"; sed -i '43,$d' "$fl"
+fi; else echo -e "2 m0\n1p\nw" | ed -s "$fl"; fi;
diff --git a/m b/m
new file mode 100755
index 0000000..0cf742f
--- /dev/null
+++ b/m
@@ -0,0 +1,33 @@
+#!/bin/dash
+
+case "$1" in
+ "") socat - tcp-connect:localhost:6600 | grep -v '^OK' | sed 's/^$//';;
+ "dir") shift; ls "$1" | sed "s/\*//" | sed -e "$(echo 's/^/'"$(echo "$1/" | $0 strip )"'\//')" | egrep '\.(mp3|ogg|aac|flac|wav|mid|mp4|mp2|mod|mpc|mpp)';;
+ "strip") sed 's/\/$//' | sed 's:\(.*\/\)*\(.*\/\)*:\2\\/:' | sed 's/^\\\///' ;;
+ "get") shift; grep -i "^$1:" | sed 's|^'$1': \(.*\)|\1|i' ;;
+ "add") sed 's|\(.*\)|add \"\1\"|' | $0 ;;
+ "filter") shift; eval $(perl -e 'print join ("|",map { "grep -i " . $_ } @ARGV);' $*) ;;
+ "cmdlist") sed -e '1i command_list_begin' -e '$a command_list_end' ;;
+ "queue") gawk '{i--;printf "addid \"%s\" %d\n", $0, i}' ;;
+ "newlist") sed -e '1i clear' -e '$a play' ;;
+ "toggle") sed -e 's#state: \(stop\|pause\)#play#' -e 's#state: play#pause#' | tr 01 10 | tr -d : ;;
+ "reset-pl") echo add / | $0 newlist | $0 ;;
+
+ "w") $0 clear ;;
+ "d") $0 delete $2 ;;
+ "t") $0 status | grep state | $0 toggle | $0 ;;
+ "c") $0 currentsong ;;
+ "l") $0 playlist ;;
+ "g") $0 play `[ "$2" = "" ] && cat - || echo $2`;;
+ "n") $0 next ;;
+ "p") $0 previous ;;
+ "s") $0 search $2 $3 ;;
+ "ss") $0 playlistsearch $2 $3 ;;
+ *) echo $* | $0 ;;
+esac
+
+# Depreciated:
+# "n") $0 g $(dc -e "$($0 cs | grep '^Pos:' | cut -c 6-) 1 + $($0 ls | wc -l) %p");; # awesome, but unnecessary
+# "qry") $0 listall | $0 get | $0 filter $* ;;
+# "n") $0 g $($0 status | $0 get nextsongid) ;;
+# "p") $0 g $(dc -e "$($0 cs | grep '^Pos:' | cut -c 6-) 1 - p");;
diff --git a/ranpas b/ranpas
new file mode 100755
index 0000000..dda2712
--- /dev/null
+++ b/ranpas
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+echo Fetching paste list ...
+lst="$(wget pastie.org/pastes -q -O - | sed -n "0,/[\ \t]*e=\$('paste_/s///p" | tr -d "');")"
+echo Newest paste is $lst.
+
+while :; do
+ rnd="$(ruby -e "$><<1+rand($lst)")"
+ echo -e "\n"Looking up paste $rnd ...
+ wget http://www.pastie.org/pastes/$rnd/download -q -O /tmp/paste-$rnd
+ if [ -s "/tmp/paste-$rnd" ]; then
+ grep -q "<p class=\"notice\">Sorry, there is no pastie #$rnd or it has been removed\. Why not create a new pastie?</p>" /tmp/paste-$rnd
+ if [ "$?" = "0" ]; then
+ echo Paste $rnd does not exist.
+ else
+ less /tmp/paste-$rnd
+ echo -n Save?\
+ [ "$(line)" = "y" ] && echo Saving as paste $rnd in $HOME && cp /tmp/paste-$rnd $HOME
+ fi;
+ else
+ echo Empty paste.
+ fi;
+ rm /tmp/paste-$rnd
+ echo -n Quit?\
+ [ "$(line)" = "y" ] && exit
+done;
diff --git a/sc b/sc
new file mode 100755
index 0000000..4ea8f2e
--- /dev/null
+++ b/sc
@@ -0,0 +1,12 @@
+#!/bin/dash
+case "$1" in
+ "d") xrandr --nograb --output CRT1 --off --output LVDS --auto;;
+ "r") xrandr --nograb --output CRT1 --auto --primary --output LVDS --off;;
+ "c") xrandr --nograb --output CRT1 --auto --output LVDS --auto;;
+ "n") xrandr --nograb --output LVDS --auto --above CRT1 --output CRT1 --auto;;
+ "s") xrandr --nograb --output LVDS --auto --below CRT1 --output CRT1 --auto;;
+ "e") xrandr --nograb --output LVDS --auto --right-of CRT1 --output CRT1 --auto;;
+ "w") xrandr --nograb --output LVDS --auto --left-of CRT1 --output CRT1 --auto;;
+ *) xrandr --nograb ;;
+esac;
+#feh --bg-center "$BKG"
diff --git a/wls b/wls
new file mode 100755
index 0000000..71eff35
--- /dev/null
+++ b/wls
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+dird="${HOME}/.config/wireless"
+
+sudo killall wpa_supplicant &> /dev/null
+sudo dhcpcd -k wlan0 &> /dev/null
+
+ls $dird
+echo -n "--> "
+read ssid
+
+if [ ! -f "$dird/$ssid" ]; then
+ echo Creating new network profile, enter passphrase:
+ read pass
+ wpa_passphrase $ssid $pass > $dird/$ssid
+ echo "Edit file (y/[n])? "
+ read edit
+ if [ "$edit" == "y" ]; then
+ $EDITOR $dird/$ssid
+ fi;
+fi;
+
+sudo wpa_supplicant -B -i wlan0 -c "$dird/$ssid"
+sleep 3s
+sudo dhcpcd wlan0