Skip to content

Instantly share code, notes, and snippets.

View basti1302's full-sized avatar

Bastian Krol basti1302

View GitHub Profile

Go Lab

Just some random things one could try to get acquainted with Go... only to be used if you lack the creativity to come up with your own ideas ;-)

Set up your environment

  1. Install Go
  2. Maybe configure your preferred text editor for Go
@basti1302
basti1302 / random-signal.elm
Created August 19, 2015 06:23
Creating a steady timed signal from random and feeding it into HTML output
import Html exposing (..)
import Random
import Random exposing (Seed)
import Signal exposing (Signal, (<~), (~))
import Time exposing (every, second)
randomFloat : Seed -> Float
randomFloat seed = seed |> (Random.generate <| Random.float 0 1) |> fst
randomBool : Seed -> Bool
@basti1302
basti1302 / Main.elm
Last active October 23, 2015 23:49
Runtime error in Elm due to shadowing
import Html
type alias Model = { a : String }
one = { a = "1" }
two = { a = "2" }
getNext : Model -> Model
getNext current =
let
@basti1302
basti1302 / change_keyboard_us_to_de.txt
Last active December 11, 2015 05:18
What you need to type to change the keyboard layout from "us" to "de" on CentOS, Fedora and similar Linux systems, when the actual keyboard has a German layout. There are quite a number of pages out there explaining what you need to *do*, but it's quite annoying to find the right keys to *type* while OS's keyboard layout does not match the actua…
# Lines beginning with # are not to be typed :-)
# Type this:
vi -etc-szsconfig-kezboard # vi /etc/sysconfig/keyboard
# The file probably looks like this:
KEYBOARDTYPE="pc"
KEYTABLE="us"
# Now type this:
@basti1302
basti1302 / install_ruby_cucumber_phantomjs_windows.markdown
Last active December 20, 2015 01:29
install_ruby_cucumber_phantomjs_debian.markdown
@basti1302
basti1302 / pyramid.js
Created October 26, 2013 08:07
Compare the consumption of a Hypermedia API with and without Traverson
'use strict';
var request = require('request')
var traverson = require('./traverson')
var rootUri = 'https://api.github.com/'
// optional: raises the rate limit of the GitHub API from 60 requests to 5000 requests per hour
var ghUser = 'basti1302',
ghPass = '...'
Test suite dbmigrations-tests: RUNNING...
### Failure in: 1:MySQL backend tests
test/BackendTest.hs:120
Installed migrations
expected: ["root"]
but got: ["root","second"]
Cases: 80 Tried: 80 Errors: 0 Failures: 1
Migration created successfully: "first"
Migration created successfully: "first"
Migration created successfully: "second"
@basti1302
basti1302 / Util.Migration.hs
Created October 27, 2016 09:25
Use jtdaugherty/dbmigrations to upgrade the DB at app startup
{-# LANGUAGE ScopedTypeVariables #-}
module Util.Migration (upgradeDatabase) where
import qualified Util.Config as Config
import Control.Monad (forM_)
import Database.Schema.Migrations
import Database.Schema.Migrations.Backend
import Database.Schema.Migrations.Filesystem (FilesystemStoreSettings (..),
@basti1302
basti1302 / 01 readme.markdown
Last active December 10, 2017 22:56
Custom combinator which accesses the Auth Context