Skip to content

Instantly share code, notes, and snippets.

# Common configuration.
AllCops:
# Additional cops that do not reference a style guide rule may be enabled by
# default. Change behavior by overriding StyleGuideCopsOnly, or by giving
# the --only-guide-cops option.
StyleGuideCopsOnly: true
# Use ` or %x around command literals.
Style/CommandLiteral:
EnforcedStyle: mixed
transform(State1,State2,[State1|Plan]) :-
transform(State1,State2,[State1],Plan), Plan \== [].
transform(State,State,Visited,[]).
transform(State1,State2,Visited,[State|Actions]) :-
edge(State1,State),
not(member(State,Visited)),
transform(State,State2,[State|Visited],Actions).
edge(a,b).
@jesg
jesg / app.rb
Last active December 24, 2022 09:27
run sinatra on puma application server behind nginx as a reverse proxy
# /home/<user>/hello-nginx-sinatra/app.rb
require 'rubygems'
require 'sinatra/base'
class App < Sinatra::Application
get '/app' do
"hello world!"
end
@jesg
jesg / gist:f4e86e897010edc3f46a
Last active August 29, 2015 14:10
systemd config for standalone selenium on docker
[Unit]
Description=Selenium Standalone Server
Requires=docker.service
After=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill selenium-standalone
ExecStartPre=-/usr/bin/docker rm selenium-standalone
ExecStartPre=-/usr/bin/docker pull jesg/selenium:standalone
@jesg
jesg / lpopall
Last active August 29, 2015 14:06
pop all elements from a redis list
local result = {}
local length = tonumber(redis.call('LLEN', KEYS[1]))
for i = 1 , length do
local val = redis.call('LPOP',KEYS[1])
if val then
table.insert(result,val)
end
end
return result
#!/bin/bash
delay=1
if (( $# == 1 )); then
delay=$1
fi
while true; do
eval $(xdotool getmouselocation --shell 2> /dev/null)
module Lisp
def self.lexer(str)
tokens = Array.new
str
.gsub(/\(/, ' ( ')
.gsub(/\)/, ' ) ')
.split(/\s/)
.each do |token|
@jesg
jesg / gist:9917946
Created April 1, 2014 16:40
i3-conky-configuration
out_to_x no
own_window no
out_to_console yes
background no
max_text_width 0
# Update interval in seconds
update_interval 2.0
# This is the number of times Conky will update before quitting.