Skip to content

Instantly share code, notes, and snippets.

def frontendOne(arg1,arg2):
return worker(arg1,arg2,False)
def frontednTwo(arg1,arg2):
return worker(arg1,arg2,True)
def worker(arg1,arg2,switch):
stuffWith(arg1)
stuffWith(arg2)
if switch == True:
@xrl
xrl / Makefile
Created April 15, 2014 23:10
EOS5D Mark III PTP IO error while downloading file with gp_camera_file_get
main: main.c
cc main.c -o main -l gphoto2 -l gphoto2_port
clean:
rm -rf main
class AdsSerializer < ActiveModel::Serializer
attributes :target_url,
:image_url,
:thumb_url
def image_url
image.url
end
def thumb_url
thumb.url
end
/* Put your CSS here */
html, body {
margin: 20px;
}
class LogLine(object):
def __init__(self,raw_line):
self.pid = pid(raw_line)
self.ip = ip(raw_line)
self.timestamp = timestamp(raw_line)
def pid(self,line):
pass
def ip(self,line):
@xrl
xrl / gist:142708bc56453acc19b3
Created October 20, 2014 23:47
How to maintain a raring system
# You need to point apt at old-releases.ubuntu.com
sudo sed -i 's/us.archive.ubuntu.com/old-releases.archive.ubuntu.com/g' /etc/apt/sources.list
def lookup(type)
case type
when "string" then "string"
when "text" then "string"
when "boolean" then "boolean"
when "integer" then "number"
when "datetime" then "utc"
else raise "don't know corresponding type for ActiveRecord #{type}"
end
end
error: type `std::io::buffered::BufWriter<&mut [u8]>` does not implement any method in scope named `write_be_u32`
writer.write_be_u32::<BigEndian>(interval_ceiling).unwrap();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@xrl
xrl / heka_build.chef.rb
Last active August 29, 2015 14:22
How I build a heka deb with my custom plugin
user = "xavierlange"
heka_dir = "#{Chef::Config[:file_cache_path]}/heka"
%w(cmake mercurial fakeroot debhelper libgeoip-dev).each do |pkg|
package pkg
end
directory heka_dir do
owner user
group user
require 'string'
function split(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1