Skip to content

Instantly share code, notes, and snippets.

View jaykepeters's full-sized avatar
🏠
Working from home

Jayke Peters jaykepeters

🏠
Working from home
View GitHub Profile
@jaykepeters
jaykepeters / timeout_and_tick.go
Created October 24, 2018 23:36 — forked from ngauthier/timeout_and_tick.go
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout:
@jaykepeters
jaykepeters / pfclient
Created January 15, 2019 16:24
Plane Finder Client Service (Modified Port)
#!/bin/sh
### BEGIN INIT INFO
# Provides: pfclient
# Required-Start: $local_fs $remote_fs $network $time $syslog
# Required-Stop: $local_fs $remote_fs $network $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: planefinder.net ads-b decoder
# Description: pfclient decodes ADS-B data and shares to planefinder.net
### END INIT INFO
@jaykepeters
jaykepeters / lwp-cloudflare-dyndns.sh
Created February 8, 2019 02:38 — forked from Firsh/lwp-cloudflare-dyndns.sh
CloudFlare as Dynamic DNS
#!/bin/bash
# CloudFlare as Dynamic DNS
# From: https://letswp.io/cloudflare-as-dynamic-dns-raspberry-pi/
# Based on: https://gist.github.com/benkulbertis/fff10759c2391b6618dd/
# Original non-RPi article: https://phillymesh.net/2016/02/23/setting-up-dynamic-dns-for-your-registered-domain-through-cloudflare/
# Update these with real values
auth_email="email@example.com"
auth_key="global_api_key_goes_here"
zone_name="example.com"
@jaykepeters
jaykepeters / gist:fb7b410b65de47f8228aac46bd70a0e0
Created February 27, 2019 08:43
Block Pi-hole Local Host
echo > /etc/pihole/local.list
chown root:root /etc/pihole/local.list
pihole restartdns
#!/bin/bash
sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/US/Central /etc/localtime
sudo rm /etc/timezone
echo "US/Central" | sudo tee /etc/timezone
# Plain OLD
iptables -t nat -A PREROUTING -s IP -p udp --dport 53 -j REDIRECT --to-port 5300
ptables -t nat -A PREROUTING -s IP -p tdp --dport 53 -j REDIRECT --to-port 5300
# IP Based DNS Redirection
ipset -N restricted nethash
iptables -t nat -A PREROUTING -m set --match-set restricted src -p udp --dport 53 -j REDIRECT --to-port 5300
iptables -t nat -A PREROUTING -m set --match-set restricted src -p tcp --dport 53 -j REDIRECT --to-port 5300
ipset -A restricted IP
<VirtualHost *:80>
ServerName proxy.jpits.us
SSLProxyEngine on
ProxyRequests Off
ProxyPreserveHost on # Optional, may resolve login issues.
<Proxy *>
Order allow,deny
Allow from All
</Proxy>
ProxyPass / https://www.google.com/
chronometer:x:1002:1002:,,,:/home/chronometer:/bin/bash
padd:x:1002:1002:,,,:/home/chronometer:/bin/bash
<div>
<div class="container">
<div class="row app-banner-padding app-banner ">
<div class="col-md-12 text-center">
<img src="https://contacts.zoho.com/file?exp=10&t=org&ID=663860804" align="center" width="200">
</div>
</div>
</div>
</div>
### INSTALLATION(S)
# IPSET
* * * * * /sbin/ipset save > /etc/ipsetrules.save
@reboot /sbin/ipset restore -! < /etc/ipsetrules.save
## IPTABLES PERSISTENT
# 1. apt update
# 2. apt install iptables-persistent
# 3. systemctl enable netfilter-persistent
# 4. Add your rules
# 5. invoke-rc.d netfilter-persistent save