Skip to content

Instantly share code, notes, and snippets.

View levidurfee's full-sized avatar

Levi Durfee levidurfee

View GitHub Profile
@levidurfee
levidurfee / login
Created March 1, 2015 22:06
if post process login
<?php
if(isset($_POST["username"])) {
if($users->login($_POST["username"], $_POST["password"])) {
$_SESSION["logged_in"] = true;
$_SESSION["usersId"] = $users->usersId;
$_SESSION["username"] = $users->username;
$_SESSION["email"] = $users->email;
}
}
?>
@levidurfee
levidurfee / tweet-speed-results.py
Created January 31, 2016 06:17
Tweet your speed results from speedtest
#!/usr/bin/env python
import os
import sys
import csv
import datetime
import time
import twitter
def tb():
#run speedtest-cli
@levidurfee
levidurfee / index.html
Created February 1, 2016 00:37
HTML5 Template
<html lang="en">
<head>
<meta charset="utf-8">
<title>Levi Durfee</title>
<meta name="description" content="Levi Durfee">
<meta name="author" content="Levi Durfee">
<link rel="stylesheet" href="/assets/css/styles.css?v=1.0">
@levidurfee
levidurfee / txt-cellphone-email.php
Created February 1, 2016 00:55
Txt message via users cell email
<?php
$phones = array(
'3 River Wireless' => '[email protected]',
'ACS Wireless' => '[email protected]',
'Alltel' => '[email protected]',
'AT&T' => '[email protected]',
'Bell Canada' => '[email protected]',
'Bell Canada' => '[email protected]',
'Bell Mobility (Canada)' => '[email protected]',
'Bell Mobility' => '[email protected]',
#!/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()
#!/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

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:

@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...";
}
}
@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 / 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] == "-") {