Skip to content

Instantly share code, notes, and snippets.

View foxish's full-sized avatar
🎯
Focusing

Anirudh Ramanathan foxish

🎯
Focusing
View GitHub Profile
@foxish
foxish / Tcsh useful prompt (last n parts of path only)
Last active December 14, 2015 20:09
Tcsh prompt: Display last 2 elements of current directory as prompt
alias precmd 'set prompt="%c2 "' #displays last 2 elements of filepath
@foxish
foxish / Webfont
Created March 17, 2013 07:02
A very Segoe-UI looking font
17px/25px 'Merriweather', serif
Spotted in http://lucumr.pocoo.org/2011/2/1/exec-in-python/
@foxish
foxish / Speedstep: Linux Mint
Created March 26, 2013 14:52
Power Management: Linux mint
sudo apt-get install cpufrequtils sysfsutils
sudo modprobe acpi_cpufreq
sudo modprobe cpufreq_ondemand
sudo modprobe cpufreq_powersave
...
...
@foxish
foxish / git-sequence, setup
Last active December 15, 2015 15:39
git-sequence, setup
git config --global user.name "DarkCthulhu"
git config --global user.email "email@woohoo.com"
git init
git add *
git remote add origin https://github.com/DarkCthulhu/Repo.git
git push origin master
# Source: http://coffeeghost.net/2010/10/09/pyperclip-a-cross-platform-clipboard-module-for-python/
# Pyperclip v1.3
# A cross-platform clipboard module for Python. (only handles plain text for now)
# By Al Sweigart al@coffeeghost.net
# Usage:
# import pyperclip
# pyperclip.copy('The text to be copied to the clipboard.')
# spam = pyperclip.paste()
@foxish
foxish / Regex Prime
Created August 29, 2013 12:21
Perl Regex to test primality
perl -e "print 'Prime' if (1 x shift) !~ /^1?$|^(11+?)\1+$/" 13
@foxish
foxish / Quick-implementation
Last active December 22, 2015 18:28
Percolator Problem: Monte Carlo simulation
from pprint import pprint
import random
import time
NUM_ELEM = 600
NUM_SD = NUM_ELEM*NUM_ELEM #single dim
dyns = None
matrix = None
experiment_attempts = 2
@foxish
foxish / context.c
Created October 28, 2013 12:54
Context switches
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/time.h>
#include <inttypes.h>
#include <semaphore.h>
pthread_cond_t CONDITION;
pthread_mutex_t LOCK;
uint32_t COUNTER;
@foxish
foxish / kadane.py
Created October 29, 2013 09:33
Kadane's algorithm, along with finding sum-array bounds
a = [3, -1, 5, -12, 0, -6, 3, 5, -12]
end_seq = []
max_ending_here = max_so_far = n = 0
for i in range(len(a)):
if max_ending_here + a[i] > a[i]:
max_ending_here = max_ending_here + a[i]
else:
max_ending_here = a[i]
@foxish
foxish / gist:8453620
Last active January 3, 2016 10:59
Projects
<colgroup/>
<colgroup id="colgroup" class="colgroup" align="left" 
		valign="middle" title="title" width="1*" 
		span="2" style="background:#ddd;" />
<thead>