Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
feh --bg-scale /home/prudhvi/Downloads/wallpaper.jpg
while true; do
xsetroot -name "`date '+%a %Y-%m-%d %H:%M:%S'`"
sleep 1
done &
exec /usr/bin/dwm
@truncs
truncs / gist:1442642
Created December 7, 2011 12:35
Mallet MaxEnt
bin/mallet import-dir --input /opt/data/* --output ~/obama.mallet
bin/mallet train-classifier --input ~/media_elections.mallet --trainer MaxEnt --output-classifier ~/media_elections.classifier --training-portion 0.9
bin/mallet classify-dir --input /opt/data --output - --classifier ~/obama.classifier
#! /usr/bin/python
def merge(a, size):
for i in range(0, len(a), size):
tmp = a[i:size + i];print tmp;
newtmp = []
for j in range(0, len(tmp)):
newtmp.append(tmp.pop(tmp.index(min(tmp))))
print newtmp
a[i:size + i] = newtmp
@truncs
truncs / trie.py
Created January 29, 2012 20:20
Simple Trie in python
#! /usr/bin/python
import unittest
class Trie(object):
""" Trie implementation in python
"""
def __init__(self, ):
""" So we use a dictionary at each level to represent a level in the hashmap
@truncs
truncs / heap.cpp
Created February 12, 2012 20:54
Heap in C++
#include <iostream>
#include <vector>
using namespace std;
template <class T>
class Heap {
vector<T> list;
void bubbleUp();
@truncs
truncs / parallel_prog.cpp
Created March 14, 2012 23:25
Parallel Programming
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
int n;
@truncs
truncs / gist:2143339
Created March 21, 2012 01:12
Parallel Prog
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdlib>
using namespace std;
int main(){
int n;
@truncs
truncs / gist:2143525
Created March 21, 2012 01:42
parallel2
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdlib>
using namespace std;
int main(){
int n;
@truncs
truncs / regress_with_random.R
Created April 6, 2012 05:24
Regression Tree using random samples
# Transform days spent to log(1 + x)
y1_data$DaysInHospital_Y2 <- log1p(y1_data$DaysInHospital_Y2)
# Divide the set, 80% for train and 20% for test
indexes <- sample(1:nrow(y1_data), size=0.2*nrow(y1_data))
test <- y1_data[indexes,]
train <- y1_data[-indexes,]
# Remove unwanted features from both the sets
train <- subset(train, select=-c(MemberID_t, YEAR_t, DaysInHospital, trainset, DaysInHospital_Y3, age_05, PayDelay_max, PayDelay_min, PayDelay_stdev, LOS_max, LOS_min,