Skip to content

Instantly share code, notes, and snippets.

View schickling's full-sized avatar
Making the web better

Johannes Schickling schickling

Making the web better
View GitHub Profile

If you run in something like this:

perl: warning: Setting locale failed.   
perl: warning: Please check that your locale settings:   
        LANGUAGE = "en_US:en",   
        LC_ALL = (unset),   
        LC_MESSAGES = "en_US.UTF-8",   
        LANG = "en_US.UTF-8"   
    are supported and installed on your system.
@schickling
schickling / .travis.yml
Created July 23, 2013 19:56
Use CasperJS with GruntJS for Travis CI
language: node_js
node_js:
- 0.6
- 0.7
- 0.8
- 0.9
- 0.10
before_script:
- npm install -g grunt-cli
- curl -L https://github.com/n1k0/casperjs/archive/1.0.3.tar.gz | tar xz
@schickling
schickling / Rakefile
Last active January 31, 2024 23:00
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@schickling
schickling / disable-sidekiq.rb
Created October 5, 2013 08:15
Disable sidekiq for testing
# disable sidekiq calls
module Sidekiq::Worker::ClassMethods
def perform_async(*args)
nil
end
end
data Tree = Branch [Tree]
deriving Show
{- first int is the min cover; second int is the min cover that includes the root -}
minVC :: Tree -> (Int, Int)
minVC (Branch subtrees) = let
costs = map minVC subtrees
minWithRoot = 1 + sum (map fst costs) in
(min minWithRoot (sum (map snd costs)), minWithRoot)
@schickling
schickling / virtualbox.md
Created November 19, 2013 17:58
Remove old/inaccessible Virtualbox VMs

Remove old/inaccessible Virtualbox VMs

VBoxManage list vms # identify inaccessible VM
VBoxManage unregistervm 37b94dab-33a6-42c0-a2f2-78cb1f8bb880 # your UUID
@schickling
schickling / load-script.js
Created June 6, 2014 14:16
Minimal dynamic javascript loader
function loadScript(src) {
var el = document.createElement('script');
el.setAttribute('src', src);
el.async = false;
document.body.appendChild(el);
}
[
'jquery.js',
'main.js',
@schickling
schickling / ENV.md
Last active August 29, 2015 14:03
One command working enviornment setup

This script automatically sets up my vim environment on any machine. For example in a docker container or an EC2 instance.

Dependencies

  • wget
  • vim
  • git

Usage

@schickling
schickling / README.md
Last active September 23, 2020 09:41
Install OpenVPN on Ubuntu 14.04 for yourserver.se

Preconditions

  • You need to have TUN/TAP enabled

Install dependencies

$ apt-get install -y openvpn easy-rsa
@schickling
schickling / UIImageFixedOrientationExtension.swift
Last active February 4, 2024 15:00
Extension to fix orientation of an UIImage (Sets orientation to portrait)
extension UIImage {
func fixedOrientation() -> UIImage {
if imageOrientation == UIImageOrientation.Up {
return self
}
var transform: CGAffineTransform = CGAffineTransformIdentity