Skip to content

Instantly share code, notes, and snippets.

@Tugzrida
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
#!/usr/bin/python3
# v0.5 Created by Tugzrida(https://gist.github.com/Tugzrida/5910e1b1a9d096e297e793890b7c5236)
# 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
veox / geth.service
Last active Aug 2, 2018
go-ethereum systemd config
View geth.service
[Unit]
Description=go-ethereum node
After=network.target
[Service]
Type=simple
User=geth
Group=geth
## ===== initial sync: no light peers, please =====
ExecStart=/usr/bin/geth --nousb --datadir /home/geth/.ethereum --cache 2048 --txpool.pricelimit 99999999999 --txpool.globalslots 1024
@swaldman
swaldman / GethAsAService.md
Last active Jul 28, 2020
Setting up geth as a service under systemd (Updated for Fedora 27)
View GethAsAService.md

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/multi-user.target.wants/geth.service to /usr/lib/systemd/system/geth.service
  6. systemctl enable geth followed by systemctl start geth
@nl5887
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
fohlin / forms.py
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...)
View forms.py
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):
You can’t perform that action at this time.