Skip to content

Instantly share code, notes, and snippets.

@lloeki
lloeki / patch_ati6870_gibba.sh
Created April 10, 2014 12:36
Fix 5-ports for ATI 6870 on OSX (10.8/10.9) using Gibba framebuffer
cd /System/Library/Extensions/ATI6000Controller.kext/Contents/MacOS
sudo perl -pi -e 's|\x00\x04\x00\x00\x04\x03\x00\x00\x00\x01\x00\x00\x12\x04\x05\x01\x00\x04\x00\x00\x04\x03\x00\x00\x00\x01\x00\x00\x22\x05\x04\x02\x00\x08\x00\x00\x04\x02\x00\x00\x00\x01\x00\x00\x11\x02\x06\x04\x00\x02\x00\x00\x14\x02\x00\x00\x00\x01\x00\x00\x00\x00\x03\x05\x04\x00\x00\x00\x04\x02\x00\x00\x00\x01\x00\x00\x11\x02\x01\x03|\x00\x04\x00\x00\x04\x03\x00\x00\x00\x01\x00\x00\x12\x04\x04\x01\x00\x04\x00\x00\x04\x03\x00\x00\x00\x01\x00\x00\x22\x05\x05\x02\x00\x08\x00\x00\x04\x02\x00\x00\x00\x01\x00\x00\x11\x02\x06\x04\x00\x02\x00\x00\x14\x02\x00\x00\x00\x01\x00\x00\x00\x00\x03\x05\x04\x00\x00\x00\x04\x02\x00\x00\x00\x01\x00\x00\x11\x02\x01\x06|g' AMD6000Controller

Keybase proof

I hereby claim:

  • I am lloeki on github.
  • I am lloeki (https://keybase.io/lloeki) on keybase.
  • I have a public key whose fingerprint is D2CB 6310 2C72 5899 1C0D 4A53 971B 4D9F 125C D31E

To claim this, I am signing this object:

@lloeki
lloeki / lua.go
Created August 7, 2014 07:16
Go <-> Lua
package main
/*
#cgo LDFLAGS: -lluajit-5.1
#include <stdlib.h>
#include <stdio.h>
#include <luajit-2.0/lua.h>
#include <luajit-2.0/lualib.h>
#include <luajit-2.0/lauxlib.h>
@lloeki
lloeki / class_diagram.rake
Last active August 29, 2015 14:10
Rails class diagram (e.g models) with graphviz
# (c) Loic Nageleisen
# License: MIT
Node = Struct.new(:type, :name, :attributes)
Edge = Struct.new(:type, :from, :to, :name)
class DiagramGraph
def initialize
@nodes = []
@edges = []
@lloeki
lloeki / brutalize_openssl.rb
Created December 2, 2014 10:29
Violently disable OpenSSL cert validation (dangerous!)
require 'openssl'
class OpenSSL::SSL::SSLContext
def verify_mode
OpenSSL::SSL::VERIFY_NONE
end
def verify_mode=(_)
@verify_mode = OpenSSL::SSL::VERIFY_NONE
end
@lloeki
lloeki / file_check.py
Created April 25, 2012 20:08
list comprehensions
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import os
import sys
import re
from glob import iglob as glob
import time
from datetime import datetime, timedelta
@lloeki
lloeki / foo_controller.rb
Created May 29, 2012 07:05
Streaming (CSV) data in Rails 3.2
class FooController
respond_to :csv
def index
@foos = Foo.scoped
if stale?(:last_modified => Foo.something)
respond_with @gta do |format|
format.csv { stream_csv @foo }
end
end

SORT in Redis

Now that Hurl is open source I thought I'd talk a bit about one of my favorite open source projects: Redis.

In Hurl we keep track of all the hurls you make, then show them to you on the "your hurls" page:

*image*
@lloeki
lloeki / boot.rb
Created July 9, 2012 12:59
Monkeypatching Rails 2.3.14 to boot Thin by default
# ...8<...
Rails.boot!
# default to Thin
if $0 == "script/server"
# commands/server.rb (#45) is not cooperative, so we patch Rack itself
require 'rack'
module Rack::Handler
puts "Patching Rack for Thin as default"
@lloeki
lloeki / boot.rb
Created July 9, 2012 12:57
Monkeypatching rails 2.x to load Mongrel with bundler
# ...8<...
Rails.boot!
# see http://gembundler.com/rails23.html to make Bundler work with Rails 2.x (tested with 2.1, 2.2 and 2.3)
# bundler with rails 2.x prevents finding mongrel_rails in PATH
if $0 == "script/server"
# ensure active_support is loaded
require 'active_support'