Skip to content

Instantly share code, notes, and snippets.

Tugzrida / cloudflare_nginx_realip
Last active Aug 27, 2020
Simple python script to keep nginx updated with Cloudflare's IP addresses
View cloudflare_nginx_realip
# v0.5 Created by Tugzrida(
# This script should be added to the root crontab (or whichever user controls nginx)
# to run perhaps once or twice a day. It will create and keep up to date
# the file /etc/nginx/conf.d/cloudflare_realip.conf which will make all of nginx
# trust and use Cloudflare's provided client IP's.
# After updating the file, it runs nginx -t to check the config for errors, and if
# any are found, nginx will not be restarted to avoid taking things down. You may wish
# to add your own error reporting to the handle_error function below.
veox / geth.service
Last active Aug 2, 2018
go-ethereum systemd config
View geth.service
Description=go-ethereum node
## ===== initial sync: no light peers, please =====
ExecStart=/usr/bin/geth --nousb --datadir /home/geth/.ethereum --cache 2048 --txpool.pricelimit 99999999999 --txpool.globalslots 1024
swaldman /
Last active May 9, 2021
Setting up geth as a service under systemd (Updated for Fedora 27)

Setting up geth as a service under systemd Fedora 27

Prerequisite: dnf install golang

  1. Create user geth with useradd
  2. As user geth fast sync the blockchain, geth --fast --cache 1024
  3. Manually run geth --rpc as user geth and watch to see that the blockchain continues to sync properly
  4. Install the geth.service file (also in this gist) in /usr/lib/systemd/system/
  5. Make a symlink from /etc/systemd/system/ to /usr/lib/systemd/system/geth.service
  6. systemctl enable geth followed by systemctl start geth
nl5887 / gpg-agent.conf
Last active Aug 13, 2020
Using GPG Agent on OS-X
View gpg-agent.conf
launchctl unload -w -S Aqua /System/Library/LaunchAgents/gpg.agent.daemon.plist
launchctl load -w -S Aqua /System/Library/LaunchAgents/gpg.agent.daemon.plist
fohlin /
Created Jan 8, 2011
A version of Django's UserCreationForm that uses email instead of username, with some nifty features. (Maybe not super robust yet, in terms of concurrency...)
import re
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class UniqueUserEmailField(forms.EmailField):
An EmailField which only is valid if no User has that email.
def validate(self, value):