Skip to content

Instantly share code, notes, and snippets.

View omalley's full-sized avatar

Owen O'Malley omalley

View GitHub Profile
>>> def fib(n):
... last = 0
... current = 1
... for i in range(n):
... (last, current) = (current, last + current)
... return current
...
>>> fib(3)
3
>>> fib(100)
enum LogLevel {
TRACE, DEBUG, INFO, WARN, ERROR, FATAL
}
record LogLocation {
union{null, string} className;
union{null, string} fileName;
union{null, long} lineNumber;
union{null, string} methodName;
}
#!/usr/bin/python3
#
import os
import subprocess
import sys
cherry_pick_file = ".git/CHERRY_PICK_HEAD"
if os.path.exists(cherry_pick_file):
commit_msg_file = sys.argv[1]
# Get the initial install time
FLASH_TIME=$(opkg info busybox | grep '^Installed-Time: '| cut -d' ' -f2)
# For each installed package
# if it was installed by the user
# and it was installed after the flash_time
# and it isn't a dependency, print it out
opkg list-installed | cut -d' ' -f1 | xargs -n 1 opkg info | \
awk -F: '/Package:/ {pkg = $2; gsub(" ","", pkg)} /Depends:/ {split($2,parts,", "); for (i in parts) {split(parts[i], words, " "); dep[words[1]] = 1}} /Status:/ {status = $2} /Installed-Time:/ {if ($2 > '"$FLASH_TIME"' && status == " install user installed") {pkglist[pkgcnt++] = pkg}} END {for (i in pkglist) {pkg = pkglist[i]; if (!(pkg in dep)) {print pkglist[i]}}}' | \
sort