Skip to content

Instantly share code, notes, and snippets.

View dtgay's full-sized avatar

David Gay dtgay

View GitHub Profile
@apsun
apsun / duplicity-backup.md
Last active September 2, 2023 19:40
Backup files using duplicity to Backblaze B2

duplicity -> Backblaze B2

Daily systemd timer to backup the contents of my filesystem to Backblaze B2. As-written, it will keep up to a year's worth of backups, performing one full backup every month. This script was tested with duplicity 2.1.0.

Configure the script

Create a B2 bucket and an application key with read/write permissions to that bucket. Configure object lock with a sufficiently long period (I use 3x the full backup period) to ensure that ransomware won't be able to nuke your backups. Also ensure the 'list all bucket names' option is enabled (unless you want to use the

getHexColor = (color) ->
return "" unless color
return color if /^#/.test(color)
rgbValues = getRGBValues(color)
hexValues = rgbValues.map(numberToHex)
"#" + hexValues.join("")
numberToHex = (number) ->
"0#{number.toString(16)}".slice(-2).toUpperCase()
@thomaspoignant
thomaspoignant / export_dokuwiki
Last active March 17, 2024 03:06
Dokuwiki, export all pages with one command line. The result is all the wiki pages and files in html
wget \
--recursive \
--no-clobber \
--page-requisites \
--no-check-certificate \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--no-parent \
--domains yourdomain.com \
@tabrindle
tabrindle / webp-convert-directory.sh
Last active April 30, 2024 14:03
Convert all files in directory to webp, with default params, or standard cwebp params passed from command
#!/bin/bash
PARAMS=('-m 6 -q 70 -mt -af -progress')
if [ $# -ne 0 ]; then
PARAMS=$@;
fi
cd $(pwd)
@joepie91
joepie91 / vpn.md
Last active May 9, 2024 17:09
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
anonymous
anonymous / night-before-opsmas.txt
Created December 24, 2013 07:19
Twas the night before Opsmas..
'Twas the night before Christmas, when all through the racks
Not a server was alerting, not even Compaqs.
The backups were written to tapes with care
In hopes that later the data would be there.
The machines were nestled all snug in their sleds
Whilst visions of vengeance danced in their heads;
And oncall in his three-wolf and I in my rack.
Had just settled down for some syn and some ack.
@decause
decause / awardbadge.py
Last active December 15, 2015 04:39
Example code for awarding a badge via the tahrir-api
from tahrir_api.dbapi import TahrirDatabase
db = TahrirDatabase('backend://badges:badgesareawesome@localhost/badges')
badge_id = 'fossbox'
person_email = 'person@email.com'
person_id = hash(person_email)
issued_on = None
class directory(object):
""" pushd/popd context manager.
Use like:
>>> with directory("/tmp/"):
... pass # do some stuff
"""
def __init__(self, newPath):
@ryansb
ryansb / doordecs.py
Created March 10, 2013 16:34
Just put an image at ./dec.jpg (or any other image you like) and input your names and you're all set to print as many door decs as you need. Work saved.
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
font = ImageFont.truetype("/usr/share/fonts/dejavu/DejaVuSans.ttf", 75)
namelist = [
# names go here
]
@ralphbean
ralphbean / coder-shell.py
Created July 4, 2012 19:52
Having fun with coderwall
""" Run like: $ python coder-shell.py
First you need to: $ pip install coderwall requests fabulous
"""
from coderwall import CoderWall
import fabulous.image
import fabulous.text
import os
import requests