Skip to content

Instantly share code, notes, and snippets.

View major's full-sized avatar
🤠
Yeehaw.

Major Hayden major

🤠
Yeehaw.
View GitHub Profile
def _regexp_filter_by_column(instance, filter_name, filter_re):
try:
v = getattr(instance, filter_name)
except AttributeError:
return True
if v and filter_re.match(str(v.encode('utf-8'))):
return True
return False
# Inject files, if necessary
injected_files = instance.get("injected_files")
if injected_files:
# Check if this is a JSON-encoded string and convert if needed.
if isinstance(injected_files, basestring):
@major
major / gist:3501787
Created August 28, 2012 18:29
Southwest Airlines Wifi Traceroute
--- Nice Trace to Icanhazip.com ---
1) 192.168.33.1 (192.168.33.1) 2.545 ms, 4/4 ps, 0.0% loss
2) * * *
3) * * *
4) * * *
5) * * *
6) 192.168.14.102 (192.168.14.102) 3147.085 ms, 2/3 ps, 100.0% loss
7) host6714200242235.direcway.com (67.142.235.242) 3078.600 ms, 2/3 ps, 100.0% loss [AS 6621] United States
8) host6714200189128.direcway.com (67.142.128.189) 2974.794 ms, 2/3 ps, 100.0% loss [AS 6621] United States
@major
major / gist:3708780
Created September 12, 2012 18:16
Lenovo T430s delayed. Again.
Dear Major Hayden,
Order Number: xxxxxxxxxx
Thank you for your recent of Lenovo's T430s.
Unfortunately, your order has been delayed due to
a part constraint. We have received all parts and
are at this time working to get all orders out as
soon as possible. Currently all orders are shipping
@major
major / gist:5598798
Created May 17, 2013 12:44
daemon writing files with incorrect SELinux contexts
# /sbin/restorecon -vR /etc/
/sbin/restorecon reset /etc/hosts.1368210781.bak~ context system_u:object_r:net_conf_t:s0->system_u:object_r:etc_t:s0
/sbin/restorecon reset /etc/shadow context system_u:object_r:etc_runtime_t:s0->system_u:object_r:shadow_t:s0
/sbin/restorecon reset /etc/sysconfig/network context system_u:object_r:etc_runtime_t:s0->system_u:object_r:etc_t:s0
/sbin/restorecon reset /etc/hosts context system_u:object_r:etc_runtime_t:s0->system_u:object_r:net_conf_t:s0
@major
major / gist:5667578
Created May 29, 2013 02:24
drbd userland tools are ready to rock for Fedora 19
[root@localhost ~]# cat /etc/redhat-release
Fedora release 19 (Schrödinger’s Cat)
[root@localhost ~]# drbdadm -V
DRBDADM_BUILDTAG=GIT-hash:\ 7ad5f850d711223713d6dcadc3dd48860321070c\ build\ by\ mockbuild@\,\ 2013-03-11\ 16:29:47
DRBDADM_API_VERSION=1
DRBD_KERNEL_VERSION_CODE=0x000000
DRBDADM_VERSION_CODE=0x080402
DRBDADM_VERSION=8.4.2
[root@localhost ~]# modinfo drbd | grep version
version: 8.4.2
@major
major / gist:5985773
Created July 12, 2013 16:28
I had no idea that hostnamectl was a thing until today.
[root@localhost ~]# hostnamectl
Static hostname: db1
Icon name: computer-vm
Chassis: vm
Machine ID: 2943f0a6e8260542b59535a148fe8041
Boot ID: b1df3ce3fc5b495a8e7d611c66d13935
Virtualization: kvm
Operating System: Fedora 19 (Schrödinger’s Cat)
CPE OS Name: cpe:/o:fedoraproject:fedora:19
Kernel: Linux 3.9.5-301.fc19.x86_64
@major
major / pyrax_clone_raxlb.py
Created January 29, 2014 07:31
Clone a Rackspace Cloud Load Balancer from HTTP -> HTTPS
#!/usr/bin/env python
import pyrax
import sys
pyrax.set_setting("identity_type", "rackspace")
pyrax.set_setting("region", "IAD")
pyrax.set_credentials("username", "API_KEY")
clb = pyrax.cloud_loadbalancers
cs = pyrax.cloudservers
@major
major / gist:9064414
Created February 18, 2014 03:58
Building zerovm toolchain on Fedora 20
[root@zerovm zvm-toolchain]# make -j4
Makefile:1036: target `SRC/directory.patch' given more than once in the same rule.
Makefile:1036: target `SRC/directory.patch' given more than once in the same rule.
Makefile:1036: target `SRC/directory.patch' given more than once in the same rule.
make -f Makefile sdkdirs
make[1]: Entering directory `/root/zvm-toolchain'
Makefile:1036: target `SRC/directory.patch' given more than once in the same rule.
Makefile:1036: target `SRC/directory.patch' given more than once in the same rule.
Makefile:1036: target `SRC/directory.patch' given more than once in the same rule.
echo "Creating the SDK tree at /root/zvm-root"
@major
major / scans_io-parser.py
Created March 17, 2014 19:04
Terrible half-done script to pull data from scans.io into mongodb
#!/usr/bin/env python
import gzip
import OpenSSL
from pymongo import MongoClient
import ssl
import sys
import textwrap
from pprint import pprint
client = MongoClient('mongodb://localhost:27017/')