Skip to content

Instantly share code, notes, and snippets.

@kausality
kausality / str2bf
Created October 18, 2011 18:00
a string to braifuck converter
/*A stupid str2bf converter!*/
#include <stdio.h>
#define MAX 100
int win=10;
char cell[MAX]={0};
int curr=0;
/*Find a number as a multiple of ten */
@kausality
kausality / battery.py
Created March 1, 2015 18:23
Linux low battery notifier
#!/usr/bin/python
import subprocess
import re
import time
# The location of the warning sound to play
PLAY='/home/kaustubh/zenbell.wav'
def loop(flag):
acpi=subprocess.check_output(['acpi','-b'])
#Cyberoam brute force
import time
import urllib.request
import urllib.parse
import sys
def fetchpage(url,values=None,header={"Referer":"http://www.google.co.in/"}):
data=None
try:
if values!=None:
@kausality
kausality / normaldist.m
Last active October 9, 2015 22:33
Simulating Sampling distribution of Sample mean is a Normal distribution
# Created on GNU Octave 3.8.1
# Demonstrates that Sampling Distribution of the Sample Mean follows a Normal Distribution
global max=30; # Numbers 1-max for which to generate probability table
global dist; # Stores the probability distribution table: dist(1,x)->probability, dist(2,x)->Number
# Generate probability distribution table for total of max numbers
function randgen
global max;
global dist;
@kausality
kausality / streaming.py
Created September 5, 2017 21:05 — forked from bdarnell/streaming.py
Demo of streaming requests with Tornado
"""Demo of streaming requests with Tornado.
This script features a client using AsyncHTTPClient's body_producer
feature to slowly produce a large request body, and two server
handlers to receive this body (one is a proxy that forwards to the
other, also using body_producer).
It also demonstrates flow control: if --client_delay is smaller than
--server_delay, the client will eventually be suspended to allow the
server to catch up. You can see this in the logs, as the "client
@kausality
kausality / app.py
Created September 5, 2017 21:05 — forked from rickardb/app.py
Simple iostream example.
import logging
import socket
import tornado.ioloop
import tornado.iostream
import tornado.options
# Nothing listening here
host = "127.0.0.1"
port = 12345