Skip to content

Instantly share code, notes, and snippets.

@tuxce
tuxce / pac_down.sh
Created January 29, 2013 15:07
Download package & dependencies e.g : pac_down.sh -y base
#!/bin/bash
db=$(mktemp -d)
trap "rm -r $db" 0
ln -s /var/lib/pacman/sync "$db/sync"
pacman --dbpath $db -Sw "$@"
@tuxce
tuxce / digicrown.ino
Created October 4, 2012 16:53
Communication between arduino & digicrown sensor
#define LED 13
void setup() {
Serial.begin(9600);
Serial2.begin(9600);
UCSR2C = UCSR2C | B00100000; // parity even
UCSR2C = UCSR2C & ~B00010000; // parity even
UCSR2C = UCSR2C & ~B00001000; // 1 stop
UCSR2C = UCSR2C | B00000110; // length 8
@tuxce
tuxce / deptree.sh
Created September 21, 2012 10:08
Display dependencies of packages (Arch) from sync DB
#!/bin/bash
fmt="%D"
max=3
while [[ $1 =~ ^- ]]; do
case "$1" in
-o) fmt+=" %o";;
-n) max="$2"; shift ;;
-*) exit 1;;
esac
@tuxce
tuxce / ck-guess
Created November 3, 2011 11:44
Get user's ck sessions and display their states
#!/bin/bash
ck_ds () {
local object=$1 interface=$2 method=$3; shift 3
dbus-send --system --type=method_call --print-reply \
--reply-timeout=2000 \
--dest=org.freedesktop.ConsoleKit \
"/org/freedesktop/ConsoleKit/$object" \
"org.freedesktop.ConsoleKit.$interface.$method" "$@"
}
@tuxce
tuxce / rollback
Last active September 27, 2015 21:28
Archlinux: Rollback whole system or a set of packages using ARM
#!/bin/bash
CHECK=0
ARMURL="http://arm.konnichi.com"
usage ()
{
echo $(basename "$0")" [-c] <date> [pkg1 pkg2 ...]"
exit 0
}
@tuxce
tuxce / wrap.sh
Created September 24, 2011 09:48
Run different command
#!/bin/bash
cmd=yaourt
file_args=paclist
args=()
opts=()
while [[ $1 ]]; do
arg=$1; shift
[[ $arg = "--" ]] && break;