Skip to content

Instantly share code, notes, and snippets.

View KushalP's full-sized avatar

Kushal Pisavadia KushalP

View GitHub Profile
#define Swap(X,Y) do{ __typeof__ (X) _T = X; X = Y; Y = _T; }while(0)
/**
* A recursive factorial method
*/
int factorial(int n)
{
if (n == 0)
{
return 1;
}
else
# A recursive factorial method
import math
def my_factorial1(n):
return math.factorial(n)
def my_factorial2(n):
z = 1
if n > 1:
#include <stdio.h>
/* This function assumes the passed pointer points to a valid, zero-terminated string */
void reverse(char *s)
{
char *t = s;
while (*t != '\0') t++;
while (s < t)
def reverse(n):
return n[::-1]
#include <stdio.h>
int bit_count(int n);
int main()
{
int i, limit = 255;
for (i = 0; i <= limit; i++)
{
#!/bin/sh
# This is a custom script to check our DNS servers.
# This is just a test across a few publicly available DNS points for
# latency etc.
isp=$(dig +noall +stats 2>&1 | awk '$2~/^SERVER:$/{split($3,dnsip,"#");print dnsip[1]}');
m="-------------------------------------------------------------------------------";
s=" ";
SELECT SUBSTRING(MD5(RAND()) FROM 1 FOR 6) AS `password`
# replace HEAD with your revision number
# replace 80 with your char limit
git rev-list HEAD |\
xargs -iX sh -c\
"if test \"\$(git show --quiet --pretty=format:%s%n%n%b X | wc -c)\" -lt 80; then echo X; fi"
/*
HTTP Host: static.ak.fbcdn.net
Generated: April 28th 2010 3:07:47 PM PDT
Machine: 10.16.140.106
Locale: nu_ll
Path: js/iphone/fb.js
*/
if (window.CavalryLogger) {
CavalryLogger.start_js(["js\/iphone\/fb.js"]);