Skip to content

Instantly share code, notes, and snippets.

View chrisledet's full-sized avatar
⚔️

Chris Ledet chrisledet

⚔️
View GitHub Profile
@chrisledet
chrisledet / OpenGLVersionChecker.java
Created February 25, 2014 03:57
Utility class for checking supported OpenGL versions on Android
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
public class OpenGLVersionChecker {
final Context context;
final ConfigurationInfo configurationInfo;
public OpenGLVersionChecker(Context context) {
this.context = context;
@chrisledet
chrisledet / sum.clj
Created April 25, 2013 19:36
Sums up all elements in list
(defn summer
[nums]
(if (= (count nums) 1)
(peek nums)
(+ (summer (pop nums)) (peek nums))
)
)
@chrisledet
chrisledet / gist:5332577
Created April 7, 2013 21:19
Identify Macbook Pro Retina Display Manufacturer
# Look at 2nd line, if it starts with LP then it's LG, LSN means it's Samsung
ioreg -lw0 | grep \"EDID\" | sed "/[^<]*</s///" | xxd -p -r | strings -6
@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",
@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 / 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 / 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;
module MyModule
class MyClass
def my_method
10.times { p(:small) if rand < 0.5 }
end
end
end
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
@chrisledet
chrisledet / gist:860712
Created March 8, 2011 18:28
keep iphone from timing out
UIApplication sharedApplication].idleTimerDisabled = YES;