Skip to content

Instantly share code, notes, and snippets.

View levidurfee's full-sized avatar

Levi Durfee levidurfee

View GitHub Profile
@levidurfee
levidurfee / bubble.c
Last active April 10, 2017 01:28
bubbles!
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
void show_array(int numbers[], int size);
int main() {
int swap, i, large, small = 0;
int numbers[] = {
90,
@levidurfee
levidurfee / Greeter.ts
Last active April 25, 2017 00:06
Gist with multiple files, different languages, and more code
class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
<!DOCTYPE html>
<html>
<head>
<title>hi world!</title>
</head>
<body>
<p>It is me, a gist iframe in AMP!</p>
</body>
</html>
@levidurfee
levidurfee / Cache.php
Created February 17, 2017 23:10
fastcgi_cache analyzer
<?php
class fcgiCacheAnalyze {
public function __construct($file) {
$log = file_get_contents($file);
$lines = explode("\n", $log);
$pages = [];
for($i=0;$i<count($lines) - 1;$i++) {
$line = explode(" ", $lines[$i]);
if($line[2] == "-") {
@levidurfee
levidurfee / hamming.c
Created February 2, 2017 22:57
Hamming distance in C
#include "time.h"
#include "stdio.h"
int hamming_distance(long int n, long int m);
int main()
{
printf("%d [should be 3]\n", hamming_distance(0x3c3e0e1a3a1e1e1e, 0x3c3e0e3e3e1e1e1e));
printf("%d [should be 6]\n", hamming_distance(55, 64));
printf("%d [should be 32]\n", hamming_distance(0x69684858535b7575, 0xe1e1e2a7bbaf6faf));
printf("%d [should be 119]\n", 55 ^ 64);
@levidurfee
levidurfee / Boy.php
Created January 11, 2017 23:16
Inheritance in PHP
<?php
class Boy extends Person {
public function washHands() {
echo "I don't wash my hands...";
}
}

Keybase proof

I hereby claim:

  • I am levidurfee on github.
  • I am levidurfee (https://keybase.io/levidurfee) on keybase.
  • I have a public key ASAZAHbgpRiudKoiWtMyVAqYeGLnpQprY9oXj_3KI-MiPwo

To claim this, I am signing this object:

#!/usr/bin/python
import csv # Need csv to read/write csv's
import sys # Need sys to read/write files
import math # Need math to do calculations
import time # Need time to get current date
from datetime import date # Not sure about
today = date.today() # Get today's date
#!/usr/bin/python
import csv
import sys
print "Hello"
print "What is your name?"
name = raw_input()
print "What is your age?"
age = raw_input()
@levidurfee
levidurfee / txt-cellphone-email.php
Created February 1, 2016 00:55
Txt message via users cell email
<?php
$phones = array(
'3 River Wireless' => 'phonenumber@sms.3rivers.net',
'ACS Wireless' => 'phonenumber@paging.acswireless.com',
'Alltel' => 'phonenumber@message.alltel.com',
'AT&T' => 'phonenumber@txt.att.net',
'Bell Canada' => 'phonenumber@txt.bellmobility.ca',
'Bell Canada' => 'phonenumber@bellmobility.ca',
'Bell Mobility (Canada)' => 'phonenumber@txt.bell.ca',
'Bell Mobility' => 'phonenumber@txt.bellmobility.ca',