Skip to content

Instantly share code, notes, and snippets.

View chrisledet's full-sized avatar
⚔️

Chris Ledet chrisledet

⚔️
View GitHub Profile
@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 / 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 / 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;
import static android.opengl.GLES20.GL_COMPILE_STATUS;
import static android.opengl.GLES20.GL_FRAGMENT_SHADER;
import static android.opengl.GLES20.GL_LINK_STATUS;
import static android.opengl.GLES20.GL_VALIDATE_STATUS;
import static android.opengl.GLES20.GL_VERTEX_SHADER;
import static android.opengl.GLES20.glAttachShader;
import static android.opengl.GLES20.glCompileShader;
import static android.opengl.GLES20.glCreateProgram;
import static android.opengl.GLES20.glCreateShader;
import static android.opengl.GLES20.glDeleteProgram;
@chrisledet
chrisledet / gist:6c03cf98d4fe1e99b6e1
Created February 2, 2016 01:22
iTerm words regex
/-+\~_.

Linux System Metrics

CPU

  • system.cpu.idle: % Idle CPU
  • system.cpu.system: % System CPU
  • system.cpu.user: % User CPU

Disk

@chrisledet
chrisledet / indices.sql
Created January 21, 2017 04:03
View indices usage in PostgreSQL
-- filter by table name
select indexrelname, idx_scan, idx_tup_read, idx_tup_fetch from pg_stat_user_indexes where relname = '<TABLE NAME>';
-- filter by index name
select idx_scan, idx_tup_read, idx_tup_fetch from pg_stat_user_indexes where indexrelname = '<IDX NAME>';
@chrisledet
chrisledet / pdiff.sh
Last active March 29, 2018 19:07
p4 color diffs
#!/bin/bash
# pdiff: colorized diffs for linux p4 workspaces
# usage: pdiff <CL#>
p4 opened -c $1 | sed -e 's/#.*//' | p4 -x - diff -du | colordiff
@chrisledet
chrisledet / about:config.md
Created January 13, 2018 00:59 — forked from haasn/about:config.md
Firefox bullshit removal via about:config

Firefox bullshit removal

Due to the incessant swarm of complete and utter nonsense that has been forcing its way into Firefox over time, I've decided to start collecting my personal list of “must-have” about:config tweaks required to turn Firefox into a functional brower.

NOTE: Unfortunately this is somewhat out of date. The comments link to some resources that may be more up-to-date. Patches welcome.

WebSockets

These can be used for nefarious purposes and to bypass access restrictions.

1. Python code compiles to bytecode which can not run concurrently
2. GIL protects:, reference count updates, mutable types, some internal bookkeeping
3. Can't use threads
4. Python instructions are not interruptible