Skip to content

Instantly share code, notes, and snippets.

View marksteve's full-sized avatar
🏠

Mark Steve Samson marksteve

🏠
View GitHub Profile
@shadowhand
shadowhand / rmpkg.sh
Created December 21, 2011 20:38
OS X Remove Installed Package (.pkg)
#!/bin/bash
PKG="com.microsoft.mau.all.autoupdate.pkg.2.3.3"
for dir in $(pkgutil --only-dirs --files "$PKG"); do
sudo rm -rf "$dir"
done
sudo pkgutil --forget "$PKG"
(function($){
var insertAtCaret = function(value) {
if (document.selection) { // IE
this.focus();
sel = document.selection.createRange();
sel.text = value;
this.focus();
}
else if (this.selectionStart || this.selectionStart == '0') {
var startPos = this.selectionStart;
(function($){
function dragEnter(e) {
$(e.target).addClass("dragOver");
e.stopPropagation();
e.preventDefault();
return false;
};
function dragOver(e) {
e.originalEvent.dataTransfer.dropEffect = "copy";
@typehorror
typehorror / loreming.py
Created November 26, 2012 06:35
I recently wanted to generate data for a project I'm working on. Lorem ipsum offers a package but I really think it is "oversized" for what I needed: generating random text content that looks human.
import random
def paragraph(min=1, max=20):
def sentence():
nouns = ["time", "person", "year", "way", "day", "thing", "man", "world",
"life", "hand", "part", "child", "eye", "woman", "place", "work", "week",
"case", "point", "government", "company", "number", "group", "problem", "fact"]
verbs = ["be", "have", "do", "say", "get", "make", "go", "know", "take",
"see", "come", "think", "look", "want", "give", "use", "find", "tell", "ask",
"work", "seem", "feel", "try", "leave", "call"]
@Problematic
Problematic / install_pygit.sh
Created February 10, 2012 23:56
Installing pygit2 on Ubuntu 11.10
# this will install everything as root, so take that into account before you run it
# need cmake, python development headers, ZLib and OpenSSL
sudo apt-get install cmake python2.7-dev zlib1g-dev libssl-dev
mkdir libgit && cd libgit
git clone git://github.com/libgit2/libgit2.git
cd libgit2
@narfdotpl
narfdotpl / mysqldb.markdown
Created December 4, 2010 16:01
MySQLdb, Python 2.5 and OS X 10.6

MySQLdb, Python 2.5 and OS X 10.6

I wasted too much time trying to make MySQLdb work with Python 2.5 (mysteriously it worked fine with 2.7). I thought I'll share my experience.

I installed MySQLdb normally with pip install MySQL-python (yeah, ingenious name) and there were no problems. But every time I imported it, I got following error:

@maccman
maccman / pubsub.go
Last active December 15, 2016 22:30
// Go PubSub Server
//
// Usage - Subscribing:
// var conn = new EventSource('/subscribe');
// conn.addEventListener('message', function(e){ alert(e.data); }, false);
//
// Usage - Publishing:
// curl http://localhost:8080/publish -F 'msg=Hello World'
package main
@daveaspinall
daveaspinall / typekit-sync.md
Last active July 17, 2018 09:54
Save Typekit sync fonts to new location

Find the fonts you want to copy:

# Show hidden files in Finder
defaults write com.apple.finder AppleShowAllFiles YES

# Location of Typekit Synced fonts
cd /Users/daveaspinall/Library/Application\ Support/Adobe/CoreSync/plugins/livetype/.r
@rauchg
rauchg / ms.md
Created December 21, 2011 00:25
Milliseconds conversion utility.
@sleepynate
sleepynate / drums.py
Last active September 12, 2021 04:29
Use a video game controller as a drum set (perhaps a Rock Band drum kit?!) video: http://www.youtube.com/watch?v=PV9hOaZsXgs
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <nathan.dotz@gmail.com> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return - Nathan Dotz
# ----------------------------------------------------------------------------
#
# This script will use pygame to turn a rockband drum kit plugged in your USB
# port into a sampler.