Skip to content

Instantly share code, notes, and snippets.

wget -O base58.py https://raw.githubusercontent.com/keis/base58/master/base58/__init__.py
sed "s~123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ \$%*+-./:~" base58.py > base45.py
python3 -c 'import base45; print(base45.b58encode("hello world"))'
@confiks
confiks / abn-camt053-to-ing-csv.rb
Last active May 9, 2021 20:42
Convert ABN CAMT.053 ZIP file to ING semicolon separated file
require 'nokogiri'
require 'zip'
if ARGV.length != 1
puts "Usage: ruby #{File.basename(__FILE__)} ABN-CAMT053.zip"
exit
end
xml_files_content = Zip::ZipFile.open(ARGV.first) do |zip|
zip.map do |entry|
@confiks
confiks / glitch-howto.sh
Last active December 10, 2019 15:56
Simple script to run an IRMA session on a default Glitch project with a public hostname
# This method worked in March 2019. Please let me know if it fails to work for you
#
# 1. Go to: https://glitch.com/edit
# 2. In the lower left corner of the page, click on Tools -> Console
# 3. Paste the following command, and press enter:
# curl -sS https://gist.githubusercontent.com/confiks/4a65e03b4e2e8b073002b531335e8cd8/raw/glitch-howto.sh | bash
set -x
mkdir -p /app/bin
2.3.1 :001 > def foo; end
=> :foo
2.3.1 :002 > def bar1(*args, **options); foo(*args, **options); end
=> :bar1
2.3.1 :003 > def bar2(*args, **options); args == [] && options == {}; end
=> :bar2
2.3.1 :004 > def bar3; foo(*[], **{}); end
=> :bar3
2.3.1 :005 > bar1
ArgumentError: wrong number of arguments (given 1, expected 0)
require 'faraday'
# require 'byebug'
class DownloadTweedeKamer
def initialize
@scheme = "http://"
@domain = "tweedekamerlive.download.kpnstreaming.nl"
@path = "/plenairezaal/4500"
@conn = Faraday.new(
@confiks
confiks / ask_key.py
Last active May 2, 2018 20:08
A simple ansible action plugin to ask the user to input a key, in the middle of a role
# Not extensively tested
# Put this script in the action_plugins directory of your playbook directory
# If you have issues, please report it in the comments (or fork and fix)
# Usage:
# - name: "Ask the user if we should continue."
# action: ask_key prompt="Continue? Yes / No / Random (y/n/r)?" accepted_keys="['y', 'n', 'r']"
# register: answer
#
# The pressed key is now in answer.key
@confiks
confiks / namedRoutesHack.jsx
Last active September 30, 2015 21:04
A quick'n'dirty 'solution' to use named routes with react-router v1.0.0-rc1
// App.js
// Route definition and lookup creation
let routes = (
<Route path="/" name="root" component={ .. }>
<Route name="customer" path="klant" component={ .. } />
..
</Route>
);
let createRouteLookupByName = (route, prefix = route.props.path) => {
export default function httpClientMiddleware(clientImpl = window.fetch) {
return (store) => {
return (next) => (action) => {
const { httpClient, types, ...rest } = action;
if (!httpClient)
return next(action);
const [REQUEST, SUCCESS, FAILURE] = types;
httpClient(clientImpl).then(
@confiks
confiks / ImmutableCursorStore.js
Last active August 29, 2015 14:13
A tightly coupled example of how to use Immutable.js cursors together with React and a Reflux-like store
// This is a tightly coupled example of how to use Immutable.js cursors
// together with React and a Reflux-like store
// The store should be Reflux-like: the store is emitted to components using this.trigger()
// The store should emit this.stateCursor when components ask for its current state
var TurtlesStore = SomeStoreFactory.createStore({
init: () => {
this.state = Immutable.fromJS({turtles: []});
this.stateCursor = this._cursorRec(this.state);