Skip to content

Instantly share code, notes, and snippets.

@bitcloud
bitcloud / haproxy.conf
Last active August 29, 2015 13:57 — forked from gburd/haproxy.conf
# Documentation for HAProxy
# http://code.google.com/p/haproxy-docs/w/list
# http://haproxy.1wt.eu/download/1.2/doc/architecture.txt
# NOTES:
# open files limits need to be > 256000, use ulimit -n to set (on most POSIX systems)
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
@bitcloud
bitcloud / backup-hook.pl
Last active July 10, 2021 11:01
Proxmox backup-hook for Hetzner Server
#!/usr/bin/perl -w
# hook script for vzdump (--script option)
=begin comment
backuphook for Proxmox
renames files so that they include the hostname of the machine
Instructions for Hetzner Backup Server auth via SSH
@bitcloud
bitcloud / addProxmoxNoLoginConsole.sh
Last active August 29, 2015 14:11
Add default logging Console to Ubuntu Guest
#!/bin/sh
# run as root
apt-get install mingetty
cat << EOF > /etc/init/ttyProxmox.conf
# ttyProxmox - autologin mingetty
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
@bitcloud
bitcloud / 00_asset_cache_check.rb
Created December 30, 2014 01:10
Rails: Delayed Memcache invalidation (unseful for heroku deployments)
# /config/initializers/00_asset_cache_check.rb
currenthash = File.read ".cacheversion"
cachehash = Rails.cache.read "cacheversion"
puts "Checking cache version: #{cachehash} against slug version: #{currenthash}\n"
if currenthash != cachehash
puts "flushing cache\n"
Rails.cache.clear
@bitcloud
bitcloud / digitalocean_install_pdns.sh
Last active August 29, 2015 14:12
Installscript for recent debian pdns server on docker
export APT_LISTCHANGES_FRONTEND=none
export APT_LISTBUGS_FRONTEND=none
export DEBIAN_FRONTEND=noninteractive
MYSQLPW=<mysql_password>
PDNSPW=<pdns_mysql_password>
sed -e 's/ \(stable\|wheezy\)/ testing/ig' /etc/apt/sources.list > /etc/apt/sources.list.d/testing.list
sed -e 's/ \(stable\|wheezy\)/ unstable/ig' /etc/apt/sources.list | grep -v security > /etc/apt/sources.list.d/unstable.list
@bitcloud
bitcloud / init.lua
Created April 22, 2015 15:10
Connect to and update arduino over wifi with esp8266
-- Code to connect to or update an arduino over wifi with an esp8266 (nodemcu lua firmware)
-- Send a single 'B' char to switch the connection to update mode
-- echo -n 'B' | nc 192.168.178.57 8080 ; avrdude -v -p atmega328p -c arduino -P net:192.168.178.57:8080 -D -U flash:w:code.hex:i
-- there are more instructions to come, but thats it for now
-- because there is no way of reaching the esp repl with this code running, there is an override.
-- currently it delays the startup for 2 secs. In that timeframe you should pull the overridepin to GND to stop booting into redirect mode
-- just using one gpio for triggering reset on the arduino and overriding the boot sequence into redirect mode of the esp
@bitcloud
bitcloud / afpd_cleanup.sh
Created May 28, 2015 12:28
If you have a TimeMachine on a NAS oder Linux Server, sometimes it tells you that the sparsbundle is already in use. This small script cleans up old AFP connections that are already dead. Change the PROCOWNER to the afpd root process owner.
#!/bin/bash
PROCOWNER=admin
for PID in $(ps waux | grep afpd | grep -v $PROCOWNER | awk '{print $1}')
do
echo "==> checking pid $PID";
lsof -i | grep afp | grep -v $PROCOWNER | awk '{print $2}' | grep $PID > /dev/null
if [ $? -ne 0 ];
then

Keybase proof

I hereby claim:

  • I am bitcloud on github.
  • I am bitcloud (https://keybase.io/bitcloud) on keybase.
  • I have a public key whose fingerprint is B12B CAAB C57B 8307 516D 4F70 3C52 ACA8 D4F7 8E65

To claim this, I am signing this object:

@bitcloud
bitcloud / controllers_test.js
Created September 14, 2016 18:33
swagger nested controllers issue
// store in controllers/test.js
"use strict";
module.exports.test = function createToken(req, res, next) {
res.end("OK");
};
@bitcloud
bitcloud / sublime-text-macos-context-menu.md
Last active May 9, 2017 06:59 — forked from idleberg/sublime-text-macos-context-menu.md
“Open in Sublime Text” in macOS context-menu

Open in Sublime Text

  • Open Automator
  • Create a new Service
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n "$@"
  • Set “Pass input” to as arguments
  • Save as Open in Sublime Text