Skip to content

Instantly share code, notes, and snippets.

View chrisledet's full-sized avatar
⚔️

Chris Ledet chrisledet

⚔️
View GitHub Profile
from flask import Flask, request, render_template, url_for
import os
app = Flask(__name__)
UPLOAD_DIR = '/var/www/uploads/'
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
# utility methods
def allowed_file(filename):
@chrisledet
chrisledet / gist:843390
Created February 25, 2011 05:10
.gemrc
# ~/.gemrc
:update_sources: true
:bulk_threshold: 1000
:sources:
- http://gems.rubyforge.org
- http://gems.github.com
gem: --no-ri --no-rdoc
:verbose: true
:benchmark: false
:backtrace: false
@chrisledet
chrisledet / gist:851164
Created March 2, 2011 16:09
deploying cocoa app
#!/bin/bash
if [ ! "${1}" ]; then
echo "usage: $0 xcode_project_path"
exit
fi
XCODE_PROJECT_PATH=$1
XCODE_DIRECTORY="`dirname "$1"`"
XCODE_PROJECT_NAME="`basename -s .xcodeproj "${XCODE_PROJECT_PATH}"`"
@chrisledet
chrisledet / gist:860712
Created March 8, 2011 18:28
keep iphone from timing out
UIApplication sharedApplication].idleTimerDisabled = YES;
Compile-time settings (established with the "configure" script)
Version: freetds v0.82
freetds.conf directory: /usr/local/Cellar/freetds/0.82/etc
MS db-lib source compatibility: yes
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 7.0
iODBC: yes
unixodbc: no
module MyModule
class MyClass
def my_method
10.times { p(:small) if rand < 0.5 }
end
end
end
@chrisledet
chrisledet / ActiveRecord.php
Last active June 21, 2018 00:25
ActiveRecord written in PHP (written in 2008)
<?php
include_once "database.php";
class ActiveRecord
{
private $table = '';
private $table_contents = array();
private $primary_key = "id";
public $ONE_TO_ONE = 1;
@chrisledet
chrisledet / latency.txt
Created May 31, 2012 14:15 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@chrisledet
chrisledet / Peripheral Speeds.md
Created June 2, 2012 22:00
Peripheral Speeds
Peripheral Rate (bit/s) Rate (byte/s)
USB 2.0 480 Mbit/s 60 MB/s
USB 3.0 5 Gbit/s 625 MB/s
Thunderbolt 10 Gbit/s × 2 1.25 GB/s × 2
PCI Express 2.0 ×2 8 Gbit/s 1 GB/s
PCI Express 2.0 ×4 16 Gbit/s 2 GB/s
PCI Express 2.0 ×8 32 Gbit/s 4 GB/s
PCI Express 2.0 ×16 64 Gbit/s 8 GB/s
FireWire 400 393.216 Mbit/s 49.152 MB/s
@chrisledet
chrisledet / gist:4945807
Created February 13, 2013 16:26
Sublime Text config
{
"auto_complete": false,
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",