Skip to content

Instantly share code, notes, and snippets.

View Freeaqingme's full-sized avatar
💭
Hello? Is this thing on?

Dolf Schimmel Freeaqingme

💭
Hello? Is this thing on?
View GitHub Profile
@Freeaqingme
Freeaqingme / gist:5179181
Created March 17, 2013 01:40
Generate sitemap with #ZF2
<?php
$sm = $e->getApplication()->getServiceManager();
$routes = $sm->get('config')['router']['routes'];
echo '<ul>' . $this->parseRoutes($routes) . '</ul>';
protected function parseRoutes($routes, $names = array(), $url = array())
{
echo '<ul>';
@Freeaqingme
Freeaqingme / gist:6309733
Last active June 14, 2022 19:14
Netflix VPN routing. I got this setup: client -> (tun) eu vpn (tun1) --> us vpn This is the firewall config relevant to forwarding all netflix traffic from client to US vpn. This does not work. See also my blogpost on http://freeaqingme.tweakblogs.net
/sbin/iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A FORWARD -s 172.16.0.0/12 -j ACCEPT
/sbin/iptables -t nat -s 172.16.0.0/12 -o eth0 -A POSTROUTING -j SNAT --to 91.214.168.110
#
# Netflix
#
for i in /proc/sys/net/ipv4/conf/*/rp_filter ; do
echo 2 > $i
done
conn, err := grpc.Dial(
s.rpcSocketPath,
grpc.WithInsecure(),
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("unix", addr, timeout)
}))
if err != nil {
log.Fatalf("did not connect: %v", err)
}
defer conn.Close()
@Freeaqingme
Freeaqingme / build-cockroachdb-debian-package.sh
Last active October 16, 2019 02:14
Cockroachdb debian .deb package
#!/bin/bash
set -ex
release=v1.0
build_iter=1.0
version=$(echo "${release}-${build_iter}" | sed 's/^v//g')
rm -rf bin/ pkg/ pkg_root/
# File managed by Puppet
coordinator:
listenAddress:
type: "config"
value: "0.0.0.0:7201"
local:
namespaces:
- namespace: default
@Freeaqingme
Freeaqingme / libmodsecurity.go
Last active April 22, 2017 15:36
modsecurity v3 linked to Go
package main
/*
#cgo CPPFLAGS: -I/usr/local/modsecurity/include
#cgo LDFLAGS: /usr/local/modsecurity/lib/libmodsecurity.so
#include "modsecurity/modsecurity.h"
#include "modsecurity/transaction.h"
#include "modsecurity/rules.h"
@Freeaqingme
Freeaqingme / redis_
Last active January 3, 2016 14:19 — forked from colinmollenhour/redis_
#!/usr/bin/perl -w
#
## Copyright (C) 2011 Colin Mollenhour <http://colin.mollenhour.com/>
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; version 2 dated June,
## 1991.
##
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: /etc/puppet/modules/modulename/templates/authorized_keys.erb:10: syntax error, unexpected $end, expecting keyword_end
; _erbout.force_encoding(__ENCODING__)
^
cat /etc/puppet/modules/modulename/templates/authorized_keys.erb
# File managed by Puppet
#
<% @ssh_keys.each do |key| -%>
<% if scope.lookupvar('transipuser::bool_enable_two_factor_auth') == true -%>
[pid 15372] futex(0x7f56bd77a584, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 180037, {1382713223, 284066576}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
[pid 15372] clock_gettime(CLOCK_REALTIME, {1382713223, 284262812}) = 0
[pid 15372] futex(0x7f56bd77a5b0, FUTEX_WAKE_PRIVATE, 1) = 0
[pid 15372] futex(0x7f56bd77a584, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 180039, {1382713223, 294262812}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
[pid 15372] clock_gettime(CLOCK_REALTIME, {1382713223, 294443228}) = 0
[pid 15372] futex(0x7f56bd77a5b0, FUTEX_WAKE_PRIVATE, 1) = 0
[pid 15372] futex(0x7f56bd77a584, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 180041, {1382713223, 304443228}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
[pid 15372] clock_gettime(CLOCK_REALTIME, {1382713223, 304614972}) = 0
[pid 15372] futex(0x7f56bd77a5b0, FUTEX_WAKE_PRIVATE, 1) = 0
[pid 15372] futex(0x7f56bd77a584, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 180043, {1382713223, 314614972}, ffffffff) = -1 ETIMEDOUT
16:58:42.512969 IP6 2001:470:b792:1:940:2d84:8ea2:7e96 > 2a03:2880:f006:301:face:b00c:0:1: ICMP6, echo request, seq 533, length 64
16:58:42.512969 IP6 2001:470:b792:1:940:2d84:8ea2:7e96 > 2a03:2880:f006:301:face:b00c:0:1: ICMP6, echo request, seq 533, length 64
16:58:42.513011 IP6 2001:470:b792:1:940:2d84:8ea2:7e96 > 2a03:2880:f006:301:face:b00c:0:1: ICMP6, echo request, seq 533, length 64
16:58:42.542823 IP6 2a03:2880:f006:301:face:b00c:0:1 > 2001:470:b792:1:940:2d84:8ea2:7e96: ICMP6, echo reply, seq 533, length 64
16:58:42.542897 IP6 2a03:2880:f006:301:face:b00c:0:1 > 2001:470:b792:1:940:2d84:8ea2:7e96: ICMP6, echo reply, seq 533, length 64
16:58:42.557646 IP6 2a03:2880:f006:301:face:b00c:0:1 > 2001:470:b792:1:940:2d84:8ea2:7e96: ICMP6, echo reply, seq 533, length 64
16:58:42.557719 IP6 2a03:2880:f006:301:face:b00c:0:1 > 2001:470:b792:1:940:2d84:8ea2:7e96: ICMP6, echo reply, seq 533, length 64
16:58:42.572402 IP6 2a03:2880:f006:301:face:b00c:0:1 > 2001:470:b792:1:940:2d84:8ea2:7e96: ICMP6, echo reply, seq 5