Skip to content

Instantly share code, notes, and snippets.

View benjaminirving's full-sized avatar

Benjamin Irving benjaminirving

View GitHub Profile
@mblondel
mblondel / lda_gibbs.py
Last active October 9, 2023 11:31
Latent Dirichlet Allocation with Gibbs sampler
"""
(C) Mathieu Blondel - 2010
License: BSD 3 clause
Implementation of the collapsed Gibbs sampler for
Latent Dirichlet Allocation, as described in
Finding scientifc topics (Griffiths and Steyvers)
"""
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@pioz
pioz / autoclick.c
Last active July 10, 2023 15:24
Autoclick
// Written by Pioz.
// Compile with: gcc -o autoclick autoclick.c -lX11
#include <stdio.h> // printf, fprintf and fflush
#include <string.h> // memset
#include <unistd.h> // sleep and usleep
#include <X11/Xlib.h> // X11
#include <X11/Xutil.h> // XGetPixel and XDestroyImage
// Simulate mouse click
@nicerobot
nicerobot / .screenrc
Created December 7, 2011 12:59
.screenrc with "tabs" using hardstatus and caption options
# look and feel
caption always "%{= bb}%{+b w}%h %=%{=b rw} %l %{= db} ${USER}@%H %{= dg}%c"
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
# skip the startup message
startup_message off
# go to home dir
chdir
@LegoStormtroopr
LegoStormtroopr / Example.py
Last active January 23, 2020 09:42
'FingerTabs' - Horizontal Text, Horizontal Tabs in PyQt This [trivial fingertab gist](https://gist.github.com/LegoStormtroopr/5075267) is released as Public Domain, but boy would it beswell if you could credit me, or tweet me [@LegoStormtoopr](http://www.twitter.com/legostormtroopr) to say thanks!
from PyQt4 import QtGui, QtCore
from FingerTabs import FingerTabWidget
import sys
app = QtGui.QApplication(sys.argv)
tabs = QtGui.QTabWidget()
tabs.setTabBar(FingerTabBarWidget(width=100,height=25))
digits = ['Thumb','Pointer','Rude','Ring','Pinky']
for i,d in enumerate(digits):
@scribu
scribu / README.md
Last active August 5, 2019 09:59
Convert notes from Tomboy XML to Evernote XML

This is a quick script to convert notes from Tomboy to Evernote.

Usage

pip install -r requirements.txt
mkdir export/
python tomboy-export.py <tomboy-dir>
@fyears
fyears / note.md
Last active February 6, 2024 09:59
how to install scipy numpy matplotlib ipython in virtualenv

if you are using linux, unix, os x:

pip install -U setuptools
pip install -U pip

pip install numpy
pip install scipy
pip install matplotlib
#pip install PySide
@molpopgen
molpopgen / cppbinary.cc
Last active February 20, 2024 06:33
Basics of binary I/O in C++
/*
Example of how to write binary stuff in C++
Illustrates some of the various quirks/annoyances
*/
#include <iostream>
#include <fstream>
#include <string>
#include <vector>

I made a few optimizations to the cython code. The timings on my machine are:

from sequences import P53_HUMAN, P53_MOUSE
from alignment import align as py_align
from align_numpy import align as cy_align
from align_numpy2 import align as cy_align2
 
%timeit py_align(P53_HUMAN, P53_MOUSE)
1 loops, best of 3: 442 ms per loop
@chaosct
chaosct / cleanbib.py
Last active September 26, 2016 17:08
Script to clean (and sort) the bibfile exported by Mendeley
# Script to clean (and sort) the bibfile exported by mendeley
# It is then apt for versioning
# Author: Carles F. Julià <carles.fernandez(AT)upf.edu>
# You will need bibtexparser package:
# $ pip install bibtexparser
# usage: cleanbib.py library.bib
# WARNING: it overwrites the original file