Skip to content

Instantly share code, notes, and snippets.

View lsdr's full-sized avatar

Luiz Rocha lsdr

  • São Paulo, Brazil
  • 11:06 (UTC -03:00)
View GitHub Profile
@roehst
roehst / ElixirASM.ex
Created October 22, 2018 20:15
ASM can be parsed with Elixir
# just try ASM.example on IEx
# assembly-ish code parses alright
defmodule ASM do
def example() do
quote do
section data
msg db "hello, world"
len equ - msg
@lsdr
lsdr / docker_cheatsheet.md
Last active December 2, 2019 18:27
Docker Cheatsheet for the ages!

stop all running containers

docker ps | awk 'NR>1 {print $1}' | xargs docker stop

Brute force; list all and try to stop everything

docker ps -aq | xargs docker stop
@edvinasbartkus
edvinasbartkus / gist:0e99ea8305a20737f562
Last active May 20, 2022 11:08
Ruby puma.gem install on El Capitan / Mac Sierra
gem install puma -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib
@joshjordan
joshjordan / lenskit.rb
Last active October 2, 2017 13:42
Example showing usage of lenskit from Ruby, via JRuby.
require 'jbundler'
require 'example_runner'
#In a real application, include this module in your Ruby class
include ExampleRunner
user_ids.each do |user_id|
puts "Recommendations for user with id=#{user_id}:"
puts " #{item_recommender.recommend(user_id, 5)}"
end
@timm
timm / a12.py
Created May 22, 2013 20:07
Python version of non-parametric hypothesis testing using Vargha and Delaney's A12 statistic.
class Rx:
"has the nums of a treatment, its name and rank"
def __init__(i,lst):
i.rx, i.lst = lst[0], lst[1:]
i.mean = sum(i.lst)/len(i.lst)
i.rank = 0
def __repr__(i):
return 'rank #%s %s at %s'%(i.rank,i.rx,i.mean)
def a12s(lst,rev=True,enough=0.66):
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 19, 2024 07:21
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@lorn
lorn / stopwords.txt
Created May 27, 2011 16:21
pt-br stopwords
"abaixo", "aca", "acaso",
"acerca", "acima", "acola", "acula", "ademais", "adentro",
"adiante", "afinal", "afora", "agora", "agorinha", "ah", "ainda",
"alem", "algo", "alguem", "algum", "alguma", "algumas", "alguns",
"ali", "alias", "alo", "ambos", "amiude", "ante", "antes", "ao",
"aonde", "aos", "apenas", "apesar", "apos", "apud", "aquela",
"aquelas", "aquele", "aqueles", "aqui", "aquilo", "as", "assim",
"ate", "atras", "atraves", "basicamente", "bastante", "bastantes",
"bem", "bis", "bom", "ca", "cada", "cade", "caso", "certa",
"certamente", "certas", "certeiramente", "certo", "certos", "chez",
@lsdr
lsdr / ccat
Last active April 22, 2019 12:57
stuff I keep on ~/bin
#!/bin/bash
# Font: http://scott.sherrillmix.com/blog/programmer/syntax-highlighting-in-terminal/
if [ ! -t 0 ]; then
file=/dev/stdin
elif [ -f $1 ]; then
file=$1
else
echo "Usage: $0 code.c"
echo "or e.g. head code.c|$0"
exit 1