Skip to content

Instantly share code, notes, and snippets.

View aep's full-sized avatar
🥬

Arvid E. Picciani aep

🥬
View GitHub Profile
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Bundler could not find compatible versions for gem "tzinfo":
In Gemfile:
eventbrite (>= 0) ruby depends on
tzinfo (~> 0.3.22) ruby
rails (= 4.2.0.beta1) ruby depends on
activesupport (= 4.2.0.beta1) ruby depends on
tzinfo (1.2.2)
var dispatcher = new WebSocketRails('localhost:3000/websocket');
var channel = dispatcher.subscribe('test');
channel.bind('test', function(data) { console.log("hello ws"); });
@aep
aep / greed.rb
Created November 23, 2014 04:41
# someone posted their homework on #ruby with a terrible answer from some blog
# challenge accepted, so here's my answer (didn't spoiler them tho ;)
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used to calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
redis_config = YAML.load_file(File.join(Rails.root, 'config/redis.yml'))[Rails.env]
REDIS_MQTT_DB = ConnectionPool::Wrapper.new(size: redis_config['pool'], timeout: 3) do
Redis.new(:host => redis_config['host'], :port => redis_config['port'], :db => redis_config['mqtt_db'])
end
REDIS_SESSION_DB = ConnectionPool::Wrapper.new(size: redis_config['pool'], timeout: 3) do
Redis.new(:host => redis_config['host'], :port => redis_config['port'], :db => redis_config['session_time_db'])
end
class Foo
def a
4
end
def self.cached(key, &block)
define_method key.to_s do
self.a + yield
end
import event as libevent;
alias LibeventContinuation= Lambda[[Int, Short, Pointer[libevent.Struct_event_base]], []];
record LibeventContinuationBase
(
@aep
aep / mouse.sh
Created February 21, 2016 12:30
#!/bin/sh
xinput --set-prop 'Logitech M510' 'Device Accel Constant Deceleration' 3
xinput --set-prop 'Logitech Gaming Mouse G400' 'Device Accel Constant Deceleration' 3
xinput --set-prop 'Microsoft Comfort Mouse 6000' 'Device Accel Constant Deceleration' 3
xinput --set-prop 'Microsoft Microsoft 5-Button Mouse with IntelliEye(TM)' 'Device Accel Constant Deceleration' 1.5
xinput --set-prop 'USB Optical Mouse' 'Device Accel Constant Deceleration' 3
xinput --set-prop 'Logitech Unifying Device. Wireless PID:1025' 'Device Accel Constant Deceleration' 2
watchdog: wdt@2004c000 {
compatible = "rockchip,watch dog";
reg = <0xff800000 0x100>;
clocks = <&pclk_pd_alive>;
clock-names = "pclk_wdt";
interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
rockchip,irq = <0>;
rockchip,timeout = <2>;
rockchip,atboot = <1>;
rockchip,debug = <0>;
==> fs (compile)
Compiled src/fs_event_bridge.erl
Compiled src/fs_server.erl
Compiled src/fs.erl
Compiled src/sys/inotifywait_win32.erl
Compiled src/sys/fsevents.erl
Compiled src/fs_app.erl
Compiled src/sys/inotifywait.erl
Compiled src/fs_sup.erl
==> ranch (compile)
defmodule Fleet.Endpoint do
use Phoenix.Endpoint, otp_app: :fleet
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files in production.
plug Plug.Static,
at: "/", from: :fleet, gzip: false,
only: ~w(css images js favicon.ico robots.txt)