Skip to content

Instantly share code, notes, and snippets.

View RickyCook's full-sized avatar
🏳️‍🌈

Ricky Cook RickyCook

🏳️‍🌈
View GitHub Profile
@RickyCook
RickyCook / README.md
Last active December 23, 2015 23:29
Things I ALWAYS forget when recompiling my kernel

Kernel Recompile Notepad

  • make menuconfig
  • Networking support -> Networking options -> Network packet filtering framework (Netfilter) -> IP: Netfilter Configuration -> IPv4 NAT
  • make-kpkg clean
  • fakeroot make-kpkg -j8 --initrd kernel_image kernel_headers
  • http://feeds.amd.com/catalystlinux/
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
@RickyCook
RickyCook / redisdump.py
Last active December 24, 2015 01:29
Really simple script to dump test data into redis
#!/usr/bin/python
"""
REQUIREMENTS:
apt-get install python-redis
OR
pip install redis
USAGE:
./redisdump.py localhost 6380 /proc/meminfo
"""
@RickyCook
RickyCook / commands.md
Last active August 11, 2016 11:31
Kick arse console-isms
@RickyCook
RickyCook / update_stories.py
Last active December 29, 2015 16:39
Pivotal Tracer story fix
#!/usr/bin/python
import re
import requests
DEBUG = True
PROJECT_ID = ''
TOKEN = ''
@RickyCook
RickyCook / stats.sh
Last active December 31, 2015 04:39
Record free RAM and number of docs in an index for ElasticSearch over time
#!/bin/bash
########
ELASTIC_URL="<host>:9200/<index>/"
SLEEP=5
########
# AHAHHAHAHAHAHHAHAHH awwwwwful
PYTHON_CODE='
@RickyCook
RickyCook / pa.py
Last active January 3, 2016 01:59
Playing around with libpulseaudio and ctypes
"""
Very simple play with libpulseaudio
pip install libpulseaudio
Help with the API:
http://www.ypass.net/blog/2009/10/pulseaudio-an-async-example-to-get-device-lists/
http://freedesktop.org/software/pulseaudio/doxygen/index.html
"""
@RickyCook
RickyCook / example.py
Last active January 3, 2016 07:29
List a Django app's urlpatterns in a table
#
# General setup
# Import your app and set APP_URLS to your urlpatterns
#
import iss.urls
APP_URLS = iss.urls.urlpatterns
from url_levels import url_levels
out = url_levels(APP_URLS)
@RickyCook
RickyCook / #migration_notes.md
Last active January 4, 2016 05:18
South migration of a OneToOne relationship to a GenericForeignKey relationship

See models.old.py for the models we will be migrating from and models.py for the models we will be migrating to.

Step one

  1. Add the GFK to your model so that you have the OneToOne and GenericForeignKey side by side for data migration
  2. Auto generate a schema migration to add the GFK to the schema: ./manage.py schemamigration <yourapp> --auto
  3. Set the defaults for content_type_id and object_id to 1; We will change them in the data migration

Step two

@RickyCook
RickyCook / tag.sh
Last active August 29, 2015 14:03
Retrospectively tag releases from setup.py commits
#!/bin/bash
for version_line in $(git log -G 'version=' setup.py | grep commit | awk '{print $2}' | \
xargs git show --date=iso | \
grep -E '^((\+\s*version=)|(commit )|Date:)' | \
sed "s/\+\s*version='//" | sed "s/',$//" | \
sed 's/commit //' | \
sed 's/Date:\s*//' | \
awk '{printf("%s%s", $0, (NR%3 ? "," : "\n"))}' | \
sed 's/ /_/g'); do
c="$(echo $version_line | awk -F ',' '{print $1}')"
@RickyCook
RickyCook / pylint.conf
Created September 19, 2014 08:29
Default Pylint RC
[MESSAGES CONTROL]
disable=bad-continuation,
fixme,
locally-disabled,
relative-import,
star-args,
wildcard-import,
[REPORTS]
output-format=colorized