Skip to content

Instantly share code, notes, and snippets.

// Write a C function whose return value is an integer between one and five:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int sample(int minimum, int maximum)
{
int random = rand();

Add all the natural numbers below 1000 that are multiples of 3 or 5.

ℕ = { 1, 2, 3, … }

A = { x ∈ ℕ : x < 1000 }

B = { y ∈ A : 3 | y ⋃ 5 | y }

∑ B

@0x00b1
0x00b1 / gist:5409198
Last active December 16, 2015 08:58
\documentclass{standalone}
\usepackage{standalone}
\usepackage{tikz}
\newcommand { \U } { (-2, -2) rectangle ( 3, 2) (-2, 2) }
\newcommand { \A } { ( 0, 0) circle ( 1) ( 0, 1) }
\newcommand { \B } { ( 1, 0) circle ( 1) ( 1, 1) }
\newcommand { \venn } {
grammar Grammar;
fragment Uppercase : [A-Z] | '$' | '_' ;
fragment Lowercase : [a-z] ;
fragment Letter : Uppercase | Lowercase ;
fragment Operator : [\u0020-\u007F]+ ;
fragment Body : (Letter | [0-9])* ('_' Operator) ;
fragment Decimal : '0' | [1-9] [0-9]* ;
fragment Hexadecimal : '0' 'x' [0-9A-Fa-f]+ ;
fragment Octal : '0' [0-7]+ ;
if [[ !(`date | grep NZDT`) ]]; then
sudo ln -sf /usr/share/zoneinfo/Pacific/Auckland /etc/localtime
fi
sudo apt-get update
sudo apt-get --yes upgrade
sudo sed -i 's/#PasswordAuthentication no/PasswordAuthentication no/g' /etc/ssh/sshd_config
sudo sed -i 's/PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
sudo service ssh restart
% java PercolationStats 2 10000
mean = 0.666925
stddev = 0.11776536521033558
95% confidence interval = 0.6646167988418774, 0.6692332011581226
mean = 0.665575
stddev = 0.11823733497392995
95% confidence interval = 0.663257548234511, 0.6678924517654891
@0x00b1
0x00b1 / ubuntu-nginx-init.sh
Created August 28, 2012 05:07
nginx Initialization for Ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon