Skip to content

Instantly share code, notes, and snippets.

View praveer13's full-sized avatar

Praveer Naigaonkar praveer13

  • Sunnyvale
View GitHub Profile
@grantslatton
grantslatton / fizzbuzz.c
Last active August 19, 2022 11:20
FizzBuzz solved using only bit twiddling. It essentially uses two deterministic finite automata for divisibility testing.
#include <stdio.h>
int f0(unsigned int x) { return x? (x&(1<<31)? f1(x<<1) : f0(x<<1)) : 1; }
int f1(unsigned int x) { return x? (x&(1<<31)? f3(x<<1) : f2(x<<1)) : 0; }
int f2(unsigned int x) { return x? (x&(1<<31)? f0(x<<1) : f4(x<<1)) : 0; }
int f3(unsigned int x) { return x? (x&(1<<31)? f2(x<<1) : f1(x<<1)) : 0; }
int f4(unsigned int x) { return x? (x&(1<<31)? f4(x<<1) : f3(x<<1)) : 0; }
int t0(unsigned int x) { return x? (x&(1<<31)? t1(x<<1) : t0(x<<1)) : 1; }
int t1(unsigned int x) { return x? (x&(1<<31)? t0(x<<1) : t2(x<<1)) : 0; }
int t2(unsigned int x) { return x? (x&(1<<31)? t2(x<<1) : t1(x<<1)) : 0; }
library(ggplot)
nosql.df <- read.csv("nosql.csv", header=TRUE)
nosql.df$Database <- factor(nosql.df$Database,
levels=c("MongoDB","Cassandra","Redis","HBase","CouchDB",
"Neo4j","Riak","MarkLogic","Couchbase","DynamoDB"))
gg <- ggplot(data=nosql.df, aes(x=Quarter, y=Index))
gg <- gg + geom_point(aes(color=Quarter), size=3)
gg <- gg + facet_grid(Database~.)
@JoesDataDiner
JoesDataDiner / Housing.R
Created October 13, 2013 16:48
UK House Prices vs. Household Incomes
rm(list=ls())
library(plyr)
library(ggplot2)
library(RColorBrewer)
price_data_dir = "C:\\***\\"
price_data_filepaths = paste(price_data_dir,list.files(price_data_dir),sep="")
price_data_list = lapply(price_data_filepaths,FUN<-function(x) read.csv(x,header=FALSE))
price_data = do.call(rbind,price_data_list) #this gives about 1.5mil transactions during 2010-2011
price_percentiles = quantile(price_data[,2],probs = seq(0.01,0.99,by=0.01)) #we know column 2 contains the prices
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active March 5, 2026 10:16
A badass list of frontend development resources I collected over time.
@sontek
sontek / snowjob.py
Created December 22, 2011 04:24
Make your terminal snow with python
#!/usr/bin/env python
import os
import random
import time
import platform
snowflakes = {}
try:
# Windows Support