Skip to content

Instantly share code, notes, and snippets.

View dsbaars's full-sized avatar

Djuri Baars dsbaars

View GitHub Profile
@dsbaars
dsbaars / tweets-producer.py
Created January 17, 2015 15:59
Tweets Producer
from kafka import KafkaClient, SimpleProducer, SimpleConsumer
kafka = KafkaClient("bigdatavm:9092")
producer = SimpleProducer(kafka)
data = []
f = open('part0.txt', 'rU')
lines = f.read().splitlines()
for line in lines:
@dsbaars
dsbaars / Representation.CollectionRepresentation.yml
Created May 23, 2015 17:07
JMSSerializerBundle groups and Hateoas
Hateoas\Representation\CollectionRepresentation:
exclusion_policy: all
exclude: false
expose: true
properties:
rel:
exclude: false
expose: true
groups: [ Default, Hateoas ]
resources:
@dsbaars
dsbaars / Vagrantfile
Last active June 27, 2016 10:14
Hyperledger Vagrant with Parallels
# -*- mode: ruby -*-
# vi: set ft=ruby :
SRCMOUNT = "/hyperledger"
LOCALDEV = "/local-dev"
VM_CPUS = 2
VM_MEM = 4096
Vagrant.configure(2) do |config|
@dsbaars
dsbaars / convert_lei.sh
Created June 26, 2016 19:45
Convert LEI XML to CSV
xmlstarlet sel -T -t -m /lei:LEIData/lei:LEIRecords/lei:LEIRecord -v "concat(lei:LEI, ';', lei:Entity/lei:LegalName, ';', lei:Entity/lei:EntityStatus, ';', lei:Entity/lei:LegalJurisdiction, ';', lei:Entity/lei:BusinessRegisterEntityID, ';', lei:Entity/lei:BusinessRegisterEntityID/@register)" -n ~/Downloads/20160625-GLEIF-concatenated.xml > LEIdata.csv
csvclean -d ';' LEIdata.csv
mongoimport -d lei -h dbserver -c records --type csv --file LEIdata_out.csv --fields "lei,name,status,jurisdiction,entity_id,register"
@dsbaars
dsbaars / Dockerfile
Created November 15, 2016 20:23
postgres modified from docker-library to contain libpq
# vim:set ft=dockerfile:
FROM alpine:3.4
MAINTAINER Djuri Baars <dsbaars@gmail.com>
# alpine includes "postgres" user/group in base install
# /etc/passwd:22:postgres:x:70:70::/var/lib/postgresql:/bin/sh
# /etc/group:34:postgres:x:70:
# su-exec (gosu-compatible) is installed further down
@dsbaars
dsbaars / home-assistant-kvm-supervisor.sh
Last active January 4, 2024 15:40
Home Assistant with Supervisor on KVM (Ubuntu 20.04 and libvirt)
# Install dependencies
sudo apt install --no-install-recommends qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils ovmf
# See netplan config below, apply with "sudo netplan apply"
# If you already have docker running, your bridge might not work as expected because it manages your iptables rules in a way which causes problems with forwarding, below command will fix that
sudo iptables -P FORWARD ACCEPT
# Install HassOS with the QCOW2 image from https://www.home-assistant.io/hassio/installation/#alternative-install-on-a-generic-linux-host
# The below command also allows you to log in using VNC, useful for debugging
sudo virt-install --name hassos --graphics vnc,listen=0.0.0.0 --memory=2048 --vcpus=2 --disk=/var/homeassistant/hassos_ova-4.11.qcow2,format=qcow2 --boot uefi --import --os-variant=debian9 --network=bridge=br0
@dsbaars
dsbaars / show-tor-urls.sh
Last active January 14, 2022 21:58
Show all onion URLs of Umbrel apps
RED=`tput setaf 1`
GREEN=`tput setaf 2`
NC=`tput sgr0`
for hostnameFile in $(find ~/umbrel/tor/data/app* -name 'hostname' | sort) ; do
APPNAME=$(echo ${hostnameFile} | cut -d/ -f 7-7)
HOSTNAME=$(cat ${hostnameFile})
printf "%-40s" ${RED}${APPNAME}
printf "%s" ${GREEN}${HOSTNAME}
printf "${NC}\n"
@dsbaars
dsbaars / keysend.sh
Created March 3, 2022 16:41
keysend multiple nodes example
#!/bin/bash
input="keysends.txt"
while read -r line
do
# Make sure you change -a to the amount of sats you want to send, this script you run LND in a docker container called lnd
docker exec lnd lncli sendpayment --keysend --dest $line -a 1
done < "$input"
@dsbaars
dsbaars / lnd.conf
Created May 21, 2022 18:12
lnd.conf IPv4/IPv6/tor hybrid mode
[Application Options]
...
listen=:9735
...
tlsextaip=198.192.141.74
tlsextraip=2460:089c:d9f2:1603:7030:b52e:a5c5:f07c
externalip=198.192.141.74:9735
externalip=2460:089c:d9f2:1603:7030:b52e:a5c5:f07c:9735
externalhosts=rof.tools
@dsbaars
dsbaars / docker-compose.override.yml
Created May 26, 2022 12:26
Tor 0.4.7.7 with Umbrel
---
version: "3.7"
services:
tor_proxy:
container_name: tor
image: "dsbaars/tor:0.4.7.7"