Skip to content

Instantly share code, notes, and snippets.

View MCOfficer's full-sized avatar

M*C*O MCOfficer

View GitHub Profile
@Two9A
Two9A / decronym.php
Last active April 9, 2024 23:25
Decronym: A simple Reddit bot
<?php
/**
* Dirty, dirty Reddit bot: Decronym
*/
class Reddit {
const USERNAME = 'Decronym';
const PASSWORD = '***';
const CLIENTID = '***';
const SECRET = '***';
@jroyalty
jroyalty / crack.sh
Created July 19, 2014 21:43
Open an OS X PKG file
## If the package won't let you "Show Package Content" on right-click then...
pkgutil --expand Foo.pkg some/path
## This will probably yield one more more child .pkg files. Inside them
## look for the Payload file. Then...
mv Payload Payload.gz
gunzip Payload.gz
## Which results in Payload uncompressed. Use 'cpio' to extract files...
cpio -iv < Payload
@seanh
seanh / formatFilename.py
Created April 11, 2009 18:30
Turn any string into a valid filename in Python.
def format_filename(s):
"""Take a string and return a valid filename constructed from the string.
Uses a whitelist approach: any characters not present in valid_chars are
removed. Also spaces are replaced with underscores.
Note: this method may produce invalid filenames such as ``, `.` or `..`
When I use this method I prepend a date string like '2009_01_15_19_46_32_'
and append a file extension like '.txt', so I avoid the potential of using
an invalid filename.