Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
Yeehaw.

Major Hayden major

🤠
Yeehaw.
View GitHub Profile
@major
major / commitdiff.sh
Created Mar 14, 2012
Differences in commits between two branches (on rackerhacker.com)
View commitdiff.sh
MASTER=`git log --pretty=format:'%H' master | sort`
DEV=`git log --pretty=format:'%H' development | sort`
for i in `diff <(echo "${MASTER}") <(echo "${DEV}") | grep '^>' | sed 's/^> //'`;
do
git --no-pager log -1 --oneline $i;
done
@major
major / gist:2037116
Created Mar 14, 2012
pi in domain names
View gist:2037116
$ p=$(echo "scale=64;4*a(1)"|bc -l);for i in $( seq 4 $((${#p} - 1)) );do echo -n "${p:0:$i}.com: ";echo `dig +short ${p:0:$i}.com|xargs`||echo;done
3.14.com: 98.124.198.1
3.141.com:
3.1415.com:
3.14159.com: 74.94.75.217
3.141592.com: 72.32.231.8
3.1415926.com:
3.14159265.com: 209.51.133.66
3.141592653.com: 184.173.91.228
3.1415926535.com: 68.178.232.99
@major
major / dict_to_struct.py
Created Mar 22, 2012
Parse through json using object/struct syntax
View dict_to_struct.py
# From http://stackoverflow.com/a/1305663
class Struct:
def __init__(self, **entries):
self.__dict__.update(entries)
@major
major / baseextsnippet.py
Created Mar 23, 2012
Easy representation of data object in SQLAlchemy with BaseExt
View baseextsnippet.py
from sqlalchemy import create_engine, Table, Column, Integer, ForeignKey, String, DateTime
from sqlalchemy.orm import relationship, backref, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine('mysql://user:pass@localhost/databasename')
# Found: http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg18049.html
class BaseExt(object):
"""Does much nicer repr/print of class instances
@major
major / find_nova_config_flags.sh
Created Apr 10, 2012
Finding all available config flags for openstack nova
View find_nova_config_flags.sh
#!/bin/bash
git clone git://github.com/openstack/nova.git nova
cd nova
ack -ho "FLAGS\.[a-zA-Z\-_]+" | sed 's/^FLAGS\.//' | sort | uniq
#
# 489 config flags as of 2012-04-10
#
View pelican.conf.py
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
AUTHOR = u"me"
SITENAME = u"testingpelican.com"
SITEURL = "/"
ARTICLE_URL = 'posts/{date:%Y}/{date:%m}/{date:%d}/{slug}/'
ARTICLE_SAVE_AS = 'posts/{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html'
@major
major / wordpress-to-markdown.py
Created May 14, 2012
Exporting rackerhacker.com from Wordpress to Markdown
View wordpress-to-markdown.py
#!/usr/bin/env python
import codecs
import feedparser
import html2text
from pprint import pprint
import sys
import time
def slugmaker(linktext):
View wget.txt
xenon:~ major$ wget -d mysqltuner.pl
DEBUG output created by Wget 1.13.4 on darwin11.3.0.
URI encoding = `UTF-8'
--2012-05-14 14:46:03-- http://mysqltuner.pl/
Resolving mysqltuner.pl (mysqltuner.pl)... 216.69.252.100, 2606:f200:0:7::baad:d00d
Caching mysqltuner.pl => 216.69.252.100 2606:f200:0:7::baad:d00d
Connecting to mysqltuner.pl (mysqltuner.pl)|216.69.252.100|:80... connected.
Created socket 5.
Releasing 0x00007fcc9b40b500 (new refcount 1).
@major
major / sealert_output.txt
Created Jul 11, 2012
SELinux denials for xend in Fedora 17
View sealert_output.txt
Red Hat Bugzilla ticket made: https://bugzilla.redhat.com/show_bug.cgi?id=839287
[root@helium ~]# sealert -l b1392df4-dda4-4b82-914c-1e20c62fc898
WARNING: Policy would be downgraded from version 27 to 26.
SELinux is preventing /usr/bin/python2.7 from read access on the file group.
***** Plugin xen_image (91.4 confidence) suggests **************************
If you want to allow python2.7 to have read access on the group file
Then you need to change the label on 'group'
View gist:3100859
setroubleshoot: SELinux is preventing /usr/bin/python2.7 from open access on the file passwd. For complete SELinux messages. run sealert -l cc0fc41b-adc0-40b1-bbf8-722f15d30d41
setroubleshoot: SELinux is preventing /usr/bin/python2.7 from getattr access on the file /etc/passwd. For complete SELinux messages. run sealert -l 5c105b89-1bf4-4796-9dc5-5b92bc68a451
setroubleshoot: SELinux is preventing /usr/sbin/xenconsoled from read access on the file group. For complete SELinux messages. run sealert -l d772f097-70dc-4114-bca4-7ace43957963
kernel: [322697.149930] device vif18.0 entered promiscuous mode
kernel: [322697.152277] ADDRCONF(NETDEV_UP): vif18.0: link is not ready
setroubleshoot: SELinux is preventing /usr/sbin/xenconsoled from setattr access on the chr_file 1. For complete SELinux messages. run sealert -l 83fc8059-f2e1-461e-9dc2-3d0145edc7b6
setroubleshoot: SELinux is preventing /usr/libexec/pt_chown from read access on the file group. For complete SELinux messages. run sealert -l 2399fa06-648b-44e3-93f7