Skip to content

Instantly share code, notes, and snippets.

geekman

Block or report user

Report or block geekman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@geekman
geekman / lspkgbom
Created Oct 19, 2011
runs lsbom from .pkg without leaving temp files lying around
View lspkgbom
#!/bin/sh
# runs lsbom from .pkg without leaving temp files lying around
PKG=$1
[ ! -f "$PKG" ] && echo "usage: $0 <pkg-file> [ <lsbom-args> ... ]" && exit 1
shift
BOM=$(pkgutil --bom "$PKG")
lsbom $@ "$BOM"
@geekman
geekman / killgit
Created Nov 4, 2011
removes .git directories from working copy
View killgit
#!/bin/sh -x
#
# killgit - removes .git directories recursively
#
find . -type d -name .git -exec rm -rf {} \;
@geekman
geekman / gist:1360530
Created Nov 12, 2011
dmesg output of ASUS P8H67-M EVO
View gist:1360530
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Linux version 2.6.32-131.17.1.el6.x86_64 (mockbuild@c6b5.bsys.dev.centos.org) (gcc version 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC) ) #1 SMP Thu Oct 6 19:24:09 BST 2011
Command line: ro root=UUID=fce6e337-a49c-4328-87f0-d2a27013bb73 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet vga=773 usbcore.autosuspend=1
KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
Centaur CentaurHauls
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009d800 (usable)
@geekman
geekman / ppxml.py
Created Nov 17, 2011
pretty-prints XML
View ppxml.py
#!/usr/bin/python
#
# pretty print xml
# modified from http://stackoverflow.com/questions/749796
#
import xml.dom.minidom
import codecs
import sys
@geekman
geekman / gist:1403032
Created Nov 29, 2011
extract native methods from ctags file
View gist:1403032
awk 'BEGIN {FS="\t"} $4 == "m" && index($3, " native ")' < tags
@geekman
geekman / gist:1441933
Created Dec 7, 2011
unpack struct from stream-like object
View gist:1441933
#
# example:
# f = open('/path/some/file', 'r')
# age, year, c = unpack('>HHB', f)
#
import struct
def unpack(fmt, f, offset=None):
"""Unpacks data read from file stream at optionally specified offset"""
@geekman
geekman / exeshim.c
Created Jan 4, 2012
simple shim (not really) executable for logging arguments
View exeshim.c
/*
* simple replacement executable for logging arguments
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int i;
@geekman
geekman / ks.cfg
Created Mar 12, 2012
Kickstart file for a minimal CentOS VM
View ks.cfg
#
# Kickstart file for minimal CentOS VM
# http://fedoraproject.org/wiki/Anaconda/Kickstart
#
# to use, pass ks=http://server/ks.cfg to kernel
#
#version=RHEL6
install
text
@geekman
geekman / gist:2779738
Created May 24, 2012
list normal open windows (like Alt-Tab or Task Manager does)
View gist:2779738
import win32con
import win32gui
import ctypes
_user32 = ctypes.windll.user32
excludes = (_user32.GetShellWindow(), win32gui.FindWindow('Shell_TrayWnd', None))
winlist = []
win32gui.EnumWindows(lambda hwnd, l: l.append(hwnd) if \
View gist:2794679
schtasks /Change /TN \Microsoft\Windows\Maintenance\WinSAT /DISABLE
You can’t perform that action at this time.