Skip to content

Instantly share code, notes, and snippets.

View oskarhane's full-sized avatar
🏠
Working from garden office

Oskar Hane oskarhane

🏠
Working from garden office
View GitHub Profile

Hello

@oskarhane
oskarhane / esnextbin.md
Last active April 18, 2017 10:03
esnextbin sketch
@oskarhane
oskarhane / esnextbin.md
Last active April 18, 2017 10:02
esnextbin sketch
@oskarhane
oskarhane / applyReduxMiddleware.js
Created January 29, 2017 21:18
Use applyReduxMiddleware
import { getBus, applyReduxMiddleware } from 'suber'
import { createEpicMiddleware } from 'redux-observable'
import { ajax } from 'rxjs/observable/dom/ajax'
// Get the bus
const bus = getBus()
// Declare the redux-observable middleware
// Listen on the 'FETCH_USER' channel and look for github username
// in the 'payload' property.
@oskarhane
oskarhane / suber-basic.js
Created January 29, 2017 20:51
Basic suber usage
import { getBus } from 'suber'
const bus = getBus()
// Listen on channel / topic / action type
// and toggle the sidebar when something arrives
bus.take('TOGGLE_SIDEBAR', () => sidebar.toggle())
// In another part of the app
// send something on the 'TOGGLE_SIDEBAR' channel
bus.send('TOGGLE_SIDEBAR', null)

Keybase proof

I hereby claim:

  • I am oskarhane on github.
  • I am oskar (https://keybase.io/oskar) on keybase.
  • I have a public key ASAmFdr0s9By7_Tz28MKx7TOTFO9yGGQ10_Yxv3sKIxU4wo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am oskarhane on github.
  • I am oskar (https://keybase.io/oskar) on keybase.
  • I have a public key whose fingerprint is 4069 993D 74AC DF06 D59A 66FB 4FE1 AA79 E870 4033

To claim this, I am signing this object:

@oskarhane
oskarhane / app.js
Created April 25, 2014 13:21
Export any website to PDF. PhantomJS and node-phantom required.
phantom = require('phantom')
if(!process.argv[2]) {
console.log('Usage: node app.js [url]')
process.exit(1)
}
var url = process.argv[2]
phantom.create(function(ph){
ph.createPage(function(page) {
#!/usr/bin/python3
# Writter by Oskar Hane
import subprocess
import sys
import re
conf_dir = '/etc/nginx/sites-enabled/'
command = ["/usr/bin/docker ps | grep " + sys.argv[1]]
p = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
@oskarhane
oskarhane / haproxy-settings-from-docker-container.py
Created March 7, 2014 19:55
Create a HAProxy config file from a Docker container with a hostname as container name.
import subprocess
import sys
import re
conf_dir = '/etc/haproxy/conf.d/'
command = ["/usr/bin/docker ps | grep " + sys.argv[1]]
p = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
output, err = p.communicate()
d_str = output.decode("utf-8")