Skip to content

Instantly share code, notes, and snippets.

View asmeurer's full-sized avatar

Aaron Meurer asmeurer

View GitHub Profile
@fperez
fperez / ipython-0.0.1.py
Created January 8, 2012 21:05
IPython 0.0.1, a simple script to be loaded as $PYTHONSTARTUP: of historical interest only...
#!/usr/bin/env python
"""
Interactive execution with automatic history, tries to mimic Mathematica's
prompt system. This environment's main features are:
- Numbered prompts (In/Out) similar to Mathematica. Only actions that produce
output (NOT assingments, for example) affect the counter and cache.
- The following GLOBAL variables always exist (so don't overwrite them!):
_p: stores previous result which generated printable output.
@morgant
morgant / gist:1753095
Created February 6, 2012 16:25
Building GnuTLS on Mac OS X

Preparing the Build Environment

cd ~/Desktop
mkdir wget-build
cd wget-build

Building & Installing GMP 5.0.2

@sos4nt
sos4nt / xterm-256color-italic.terminfo
Created July 27, 2012 12:13
A xterm-256color based TERMINFO that adds the escape sequences for italic
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
#
# Install:
#
# tic xterm-256color-italic.terminfo
#
# Usage:
#
# export TERM=xterm-256color-italic
#
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@gromgull
gromgull / unmatchedgroup.py
Created October 20, 2012 06:01
Python "unmatched group" regex replace workaround
import re
def re_sub(pattern, replacement, string):
def _r(m):
# Now this is ugly.
# Python has a "feature" where unmatched groups return None
# then re.sub chokes on this.
# see http://bugs.python.org/issue1519638
# this works around and hooks into the internal of the re module...
@asmeurer
asmeurer / expressions.py
Created March 13, 2013 06:14
Large trig expressions These all simplify.
This file has been truncated, but you can view the full file.
from sympy import S
######## small size expression
smallExpr = S('(((-sin(q1)*sin(q3) + cos(q1)*cos(q2)*cos(q3))*sin(q4) - sin(q2)*cos(q1)*cos(q4))*sin(q1) - ((sin(q1)*cos(q2)*cos(q3) + sin(q3)*cos(q1))*sin(q4) - sin(q1)*sin(q2)*cos(q4))*cos(q1))*(ddq1*sin(q2)*sin(q3) - ddq2*((-sin(q1)*cos(q3) - sin(q3)*cos(q1)*cos(q2))*sin(q1) - (-sin(q1)*sin(q3)*cos(q2) + cos(q1)*cos(q3))*cos(q1)) - ddq3*(-(-sin(q1)*cos(q3) - sin(q3)*cos(q1)*cos(q2))*sin(q2)*cos(q1) - (-sin(q1)*sin(q3)*cos(q2) + cos(q1)*cos(q3))*sin(q1)*sin(q2) - sin(q2)*sin(q3)*cos(q2)) - ddq4*((-sin(q1)*cos(q3) - sin(q3)*cos(q1)*cos(q2))**2 + (-sin(q1)*sin(q3)*cos(q2) + cos(q1)*cos(q3))**2 + sin(q2)**2*sin(q3)**2) + dq1*dq2*sin(q3)*cos(q2) + dq1*dq3*sin(q2)*cos(q3) - dq2*(dq1*(-sin(q1)*cos(q3) - sin(q3)*cos(q1)*cos(q2))*cos(q1) + dq1*(-sin(q1)*sin(q3)*cos(q2) + cos(q1)*cos(q3))*sin(q1) - (-dq1*sin(q1)*cos(q3) - dq1*sin(q3)*cos(q1)*cos(q2) + dq2*sin(q1)*sin(q2)*sin(q3) - dq3*sin(q1)*cos(q2)*cos(q3) - dq3*sin(q3)*cos(q1))*cos(q1) + (dq1*sin(q1)*sin(q3)*co
@bfroehle
bfroehle / With Magic Demo.ipynb
Last active December 16, 2015 07:49
%with / %endwith IPython extension
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@azam
azam / svg2ico.sh
Last active February 24, 2025 11:46
Convert SVG to ICO using ImageMagick, with transparent background and multi-size icons
convert -density 256x256 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico
@eddiejaoude
eddiejaoude / most-active-users-on-github-2015.md
Last active November 30, 2017 10:30
Most active users on GitHub 2015

This is the top 1000 users on GitHub

Where are you on here?

For the first 6 months of 2015 (Jan - June).

Query used on Google's BigQuery with GitHubArchive Data

SELECT actor.login as user, COUNT(*) as total FROM (
@pudquick
pudquick / python_sysctl.py
Last active June 10, 2024 04:01
Calling sysctl from python via ctypes
from ctypes import CDLL, c_uint, byref, create_string_buffer
from ctypes.util import find_library
libc = CDLL(find_library("c"))
def sysctl(name, isString=True):
size = c_uint(0)
# Find out how big our buffer will be
libc.sysctlbyname(name, None, byref(size), None, 0)
# Make the buffer
buf = create_string_buffer(size.value)