Skip to content

Instantly share code, notes, and snippets.

View berkes's full-sized avatar
🌱
open to work

Bèr Kessels berkes

🌱
open to work
View GitHub Profile
@berkes
berkes / base.rb
Last active October 30, 2020 15:49
# frozen_string_literal: true
require 'delegate'
module Workflows
##
# Common workflow generics
class Base < SimpleDelegator
attr_reader :test_obj
@berkes
berkes / query_wtf.sql
Created August 21, 2020 14:18
lekkerdan
SELECT DISTINCT SUBPATH(categories.path, 0, 1) FROM "gauges" INNER JOIN "entities" ON "entities"."id" = "gauges"."entity_id" INNER JOIN "categories_gauges" ON "categories_gauges"."gauge_id" = "gauges"."id" INNER JOIN "categories" ON "categories"."id" = "categories_gauges"."category_id" WHERE (entities.path <@ '1924544') AND (gauges.id IN (SELECT "gauges"."id" FROM "gauges" LEFT OUTER JOIN categories_gauges
ON categories_gauges.gauge_id = gauges.id
AND categories_gauges.category_id IN (SELECT "categories"."id" FROM "categories" WHERE (categories.path <@ '5005')) WHERE (categories_gauges.category_id IN (5129,2496,2500,2504,2509,2513,2517,2521,2525,2529,8012,8015,4274,4318,4556,4322,3124,3203,3089,3081,3091,3123,3093,3059,3067,3055,3075,3125,3133,3108,3113,3114,3116,3119,3118,3129,3100,3670,3663,3700,4044,4020,4030,4011,4050,3094,3101,3194,3196,3197,3103,3038,6610,5007,5008,5006,7578,7581,7795,7802,7810,7817,7820,7824,7827,7830,7833,7836,7841,7814,7805,8933,8977,9706,9303,9323,9456,9063,9073,9076,962
#!/usr/bin/ruby
# English:
# file = "/usr/share/dict/british-english"
# file = /usr/share/dict/words
file = "/usr/share/dict/nederlands"
words = File.read(file).split("\n")
16.times do
require 'pp'
prefixes = %w{
rot
graf
plak
vuil
prut
pluis
}
@berkes
berkes / command
Last active March 6, 2020 10:40
Dutch Domains in The Duckduckgo Tracker Radar Dataset
git clone https://github.com/duckduckgo/tracker-radar
cd tracker-radar
grep -R "\"domain\":" | grep "\.nl\"" | cut -d ":" -f3- | sed "s/[ \"\,]//g"
@berkes
berkes / CouponManager.sol
Created November 26, 2018 14:52
CouponManager v0.1.0
pragma solidity ^0.4.22;
contract CouponManager {
enum Answers { NoAnswer, Approved, Denied, Pending }
struct Batch {
string description;
uint expiresAt;
uint24 amount;
uint24 free;
@berkes
berkes / gist:d163f8d1d008e9167fd10e1fa3a4b93b
Created October 24, 2017 17:58
ethereum faucet proof of access
0x88236B99814cc5374048120199473C8C62805eB4

Keybase proof

I hereby claim:

  • I am berkes on github.
  • I am berkes (https://keybase.io/berkes) on keybase.
  • I have a public key whose fingerprint is 31D5 9C42 A7BB 5038 CCC3 0C43 3A10 7C51 9147 23F8

To claim this, I am signing this object:

require "pp"
require "benchmark"
# Yea. Extremely slow and prolly Linux only
def mem_sampler
stat = GC.stat
stat.map do |k,v|
"#{k}\t#{v}"
end.join("\n")
end
@berkes
berkes / log-git-flow-feature
Created April 6, 2016 11:29
Time logging with git flow
set -e
working_dir=$(pwd)
feature=$2
action=$1
now=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # ISO8601
echo "[$now] $working_dir $action $feature" >> ~/.git-flow-feature.log