Skip to content

Instantly share code, notes, and snippets.

@michiel
michiel / collect.sh
Created Aug 16, 2017
expect + ssh + scp with password to collect data from a list of servers
View collect.sh
#!/bin/bash
PASSWORD="password"
USERNAME="username"
SSHPORT=22
@michiel
michiel / katharsis-custom-serializer.js
Created Dec 12, 2016 — forked from sivakumar-kailasam/katharsis-custom-serializer.js
Ember data serializer changes to work with katharsis, thanks to @dfalling
View katharsis-custom-serializer.js
import DS from 'ember-data';
export default DS.JSONAPISerializer.extend({
// This returns the key as-is to the model, instead of converting between a dasherized JSONAPI and a camelCased JS model.
keyForAttribute(key) {
return key;
},
keyForRelationship(key) {
return key;
@michiel
michiel / pandoc.css
Created Dec 1, 2016 — forked from killercup/pandoc.css
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
View pandoc.css
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@michiel
michiel / clean-git-dirs.sh
Created Aug 24, 2016
Clean out a directory of git repositories
View clean-git-dirs.sh
#!/bin/bash
for d in `find . -maxdepth 1 -type d`
do
pushd . > /dev/null
cd "$d"
echo "Trying $d"
if [ -d .git ]
then
git clean -fdx .
View nginx-ssl.conf
##
# SSL Settings
##
# # openssl dhparam 4096 -out /etc/nginx/dh4096.pem
ssl_dhparam /etc/nginx/dh4096.pem;
ssl_protocols TLSv1.2;
# ssl_ecdh_curve secp521r1;
@michiel
michiel / jsonSchemaInterface.ts
Created Aug 3, 2016 — forked from enriched/jsonSchemaInterface.ts
TypeScript interface for Json-Schema V4
View jsonSchemaInterface.ts
/**
* MIT License
*
* Copyright (c) 2016 Richard Adams (https://github.com/enriched)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@michiel
michiel / protocol-fix.txt
Created May 27, 2016 — forked from eculver/protocol-fix.txt
How to deal with tmux "protocol version mismatch"
View protocol-fix.txt
$ tmux attach
protocol version mismatch (client 7, server 6)
$ pgrep tmux
3429
$ /proc/3429/exe attach
@michiel
michiel / keycloak.sh
Created May 13, 2016 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
View keycloak.sh
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@michiel
michiel / transducer-rxjs-ramda.js
Created Feb 22, 2016
transducer in es6 with ramda and rxjs
View transducer-rxjs-ramda.js
const Rx = require('rx');
const R = require('ramda');
const seq = Rx.Observable.range(1, 10);
const isEven = (x) => x % 2 === 0;
const add1 = (x) => x + 1;
const transducer = R.compose(
R.map(add1),
@michiel
michiel / rethinkdb-getall.md
Created Feb 15, 2016 — forked from coffeemug/rethinkdb-getall.md
Using the `getAll` command to query multiple keys in RethinkDB 1.7.
View rethinkdb-getall.md

Querying by multiple keys

The previous releases of RethinkDB allowed querying indexes as follows:

// Three ways to get the user with primary key 5
r.table('users').get(5)
r.table('users').getAll(5)
r.table('users').getAll(5, {index: 'id'})