Skip to content

Instantly share code, notes, and snippets.

View spangenberg's full-sized avatar
🦄

Daniel Spangenberg spangenberg

🦄
View GitHub Profile
@spangenberg
spangenberg / patch_arp.sh
Created August 31, 2016 11:34
/config/scripts/post-config.d/patch_arp.sh
#!/bin/sh
read -r -d '' ARP_ACCEPT <<'EOF'
help: Enable arp-accept on this interface
create:expression: "sudo sh -c \"echo 1 > /proc/sys/net/ipv4/conf/$VAR(../../@)/arp_accept\" "
delete:expression: "sudo sh -c \"echo 0 > /proc/sys/net/ipv4/conf/$VAR(../../@)/arp_accept\" "
EOF
mkdir -p /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-accept
echo $ARP_ACCEPT > /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-accept/node.def
@spangenberg
spangenberg / PATHS.txt
Created August 31, 2016 11:21
Unifi - Add the ability to adjust system ARP settings via the CLI
/opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/disable-arp-filter/node.def
/opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-accept/node.def
/opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-announce/node.def
/opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-ignore/node.def

Keybase proof

I hereby claim:

  • I am spangenberg on github.
  • I am spangenberg (https://keybase.io/spangenberg) on keybase.
  • I have a public key ASB1EbRUlGShmXf4hBlhlSMsW2NjCTo9_AwSjypneeUueAo

To claim this, I am signing this object:

@spangenberg
spangenberg / normal_distribution.rb
Created October 13, 2014 16:25
Normal distribution
n = 6 * 10_000
loop do
hash = Hash.new { |hash, key| hash[key] = 0 }
n.times.each { hash[rand(1..6)] += 1 }
hash = Hash[hash.reduce({}) { |memo, (key, value)| memo[key] = value / (n / 100.0); memo }.sort]
if hash.values.reduce(&:+) == 100.0
hash.each { |key, value| puts "#{key} - #{value}%" }
break
require "benchmark"
b = Benchmark.realtime do
10_000_000.times.each { "HalloDasIst=EinKeyVonMir".split("=")[1] }
end
puts b
b = Benchmark.realtime do
10_000_000.times.each { "HalloDasIst=EinKeyVonMir"[12..-1] }
end
puts b
module Kernel
def null
nil
end
end
@spangenberg
spangenberg / benchmark.rb
Created July 25, 2014 08:20
Ruby EDN vs. JSON benchmark
require "active_support/json"
require "benchmark"
require "edn"
require "json"
n = 1_000_000
obj = { :hallo => "wie", :get => { :es => ["dir", 2] } }
json = obj.to_json
edn = obj.to_edn
sudo apt-get install ldap-auth-client nscd
sudo auth-client-config -t nss -p lac_ldap
sudo pam-auth-update
sudo /etc/init.d/nscd restart
getent passwd
// Hello World
require 'aws-sdk'
require 'net/http'
require 'uri'
namespace :deploy do
desc 'Deploy to OpsWorks'
task :opsworks do
unless ENV['VERSION']
puts 'Please provide a version'
exit(1)