Skip to content

Instantly share code, notes, and snippets.

View tonekk's full-sized avatar

Finn Heemeyer tonekk

View GitHub Profile
[...]
inputs: {
init: function() {
Array.prototype.forEach.call(kashoderkurs.inputs, function(index, value) {
console.log(index, value);
});
},
// This is how we do it
cash: new (function() {
@tonekk
tonekk / gist:6107fdf3cd56edb89b19
Created October 16, 2014 06:36
fix_point.h, Beuth
#ifndef FIX_POINT_H
#define FIX_POINT_H
#include <cmath>
/*
* fix_point.h
*
* Finn-Lennart Heemeyer, 791440.Beuth
*/
@tonekk
tonekk / hotfix
Created November 17, 2014 22:59
#!/bin/sh
export GIT_MERGE_AUTOEDIT=no
ruby 'bin/hotfix.rb'
unset GIT_MERGE_AUTOEDIT
class UrlValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
valid = begin
URI.parse(value).kind_of?(URI::HTTP)
rescue URI::InvalidURIError
false
end
unless valid
record.errors[attribute] << (options[:message] || "is an invalid URL")

Postgres CheatSheet

Create root user

  • Start postgres
  • psql template1
  • CREATE USER root WITH SUPERUSER;

Or

@tonekk
tonekk / dotfiles setup
Last active May 17, 2021 08:52
script to setup my dotfiles
cd && git clone git@github.com:tonekk/dotfiles.git etc && cd etc && git submodule update --init --recursive && ~/etc/bin/init && nvim -c PlugInstall
lifes = 9
puts "Try to kill me, I got #{lifes} lifes!\n"
loop do
begin
sleep 1
rescue Exception => e
lifes = lifes - 1

My personal reading list

@tonekk
tonekk / keybase.md
Created June 25, 2018 13:25
keybase identity proof

Keybase proof

I hereby claim:

  • I am tonekk on github.
  • I am tonekk (https://keybase.io/tonekk) on keybase.
  • I have a public key ASDq9OnvfGWJe7s_Q0w7AXH1eNbvfS-i6lkiN-mGDzstaAo

To claim this, I am signing this object:

#!/bin/sh
curl -s https://raw.githubusercontent.com/thisredone/rb/master/rb > rb
chmod +x rb
sudo mv rb /usr/local/bin