Skip to content

Instantly share code, notes, and snippets.

rvm:
- 2.1.10
- 2.2.6
- 2.3.3
- 2.4.1
env:
- secure: "abcd1234"
- secure: "defg4567"
matrix:
exclude:
@kke
kke / rubyscript.sh
Last active February 17, 2017 08:29
Ruby version requirement auto discovery wrapper / "conditional shebang"
#!/bin/sh
for ruby in $(which -a ruby); do
if $ruby -e "exit 1 if RUBY_VERSION < '2.1'"; then
exec $ruby -x "$0" "$@"
fi
done
echo "No suitable ruby 2.1+ interpreter found" >&2
exit 1
#!ruby
#!/usr/bin/env bash
_foo_complete() {
COMPREPLY=()
if [ "$ZSH_VERSION" == "" ]; then
local src="${BASH_SOURCE[0]}"
else
local src="${(%):-%x}"
fi
local dir=$( cd "$( dirname "$src" )" && pwd )
@kke
kke / cli.rb
Created May 24, 2016 14:02
create_device problem
# getting this:
# /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/client.rb:59:in `fail_on_error': {"errors"=>["#<Packet::Plan:0x007fb5e3946df8> is not a valid plan"]} (Packet::Error)
# from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/client.rb:24:in `block (2 levels) in <class:Client>'
require 'packet'
API_KEY=''
PROJECT_ID=''
FACILITY_CODE=''
OS_SLUG=''
/usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/base.rb:26:in `update_attributes': undefined method `each_pair' for :ams1:Symbol (NoMethodError)
from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/base.rb:22:in `initialize'
from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/associations.rb:14:in `new'
from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/associations.rb:14:in `block in has_one'
from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/base.rb:52:in `instance_exec'
from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/base.rb:52:in `_cast_value'
from /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/packethost-0.0.5/lib/packet/entity/base.rb:28:in `block in
Benchmark.bm do |x|
hash = {:foo => "foo"}
class Item
def initialize
@foo = "foo"
end
def foo
@foo
end
end
static inline bool should_roll(struct work *work)
{
struct timeval now;
time_t expiry;
if (work->pool != current_pool() && pool_strategy != POOL_LOADBALANCE && pool_strategy != POOL_BALANCE)
return false;
if (work->rolltime > opt_scantime)
expiry = work->rolltime;
listen=1
daemon=1
server=1
rpcuser=username
rpcpassword=password
rpcport=15800
gen=1
rpcallowip=127.0.0.1
rpcallowip=192.168.*
rpcallowip=10.*
@kke
kke / somepool.json
Created January 3, 2014 22:27
How to use includes for your cgminer conf's to keep gpu settings in one place instead of copypasting them to each config file
# foocoin.conf:
{
"pools" : [
{
"quota" : "4;stratum+tcp://eu.multipool.us:3349",
"user" : "user.miner1",
"pass" : "x"
},
{
"quota" : "2;stratum+tcp://foo.dedicatedpool.com:3345",
@kke
kke / xorg.conf
Last active January 1, 2016 18:09 — forked from perryh/xorg.conf
Section "ServerLayout"
Identifier "aticonfig Layout"
Screen 0 "aticonfig-Screen[0]-0" 0 0
Screen "aticonfig-Screen[1]-0" RightOf "aticonfig-Screen[0]-0"
EndSection
Section "Module"
EndSection
Section "Monitor"