Skip to content

Instantly share code, notes, and snippets.

Avatar

James Rivett-Carnac yarbelk

View GitHub Profile
@ageis
ageis / YubiKey-GPG-SSH-guide.md
Last active Sep 18, 2020
Technical guide for using YubiKey series 4 for GPG and SSH
View YubiKey-GPG-SSH-guide.md

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate). I've published a Bash function which automates this slightly special key generation process.

@ferrouswheel
ferrouswheel / conf.py
Last active Sep 22, 2017
Sphinx add-on to annotate Django models based on fields and their help_text. Based on https://djangosnippets.org/snippets/2533/ - but adds ForeignKey resolution, and ensure field.rel.to is an actual model instead of a string.
View conf.py
import sys, os
local_path = lambda path: os.path.join(os.path.dirname(__file__), path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'PROJECTNAME.settings'
sys.path.append(local_path('..'))
... # Rest of conf.py goes here
@yprez
yprez / fields.py
Last active Jul 22, 2020
Django rest framework - Base64 image field
View fields.py
import base64
from django.core.files.base import ContentFile
from rest_framework import serializers
class Base64ImageField(serializers.ImageField):
def from_native(self, data):
if isinstance(data, basestring) and data.startswith('data:image'):
# base64 encoded image - decode
@avoine
avoine / fabfile.py
Created Mar 1, 2013
Fabric plugin for juju
View fabfile.py
# Mostly from django-fab-deploy
import os
import sys
from datetime import datetime
from subprocess import Popen, PIPE
import yaml
from fabric.api import env, run, sudo, task
@adharris
adharris / postgres_array.go
Created Nov 28, 2012
PostgreSQL demo of Array types using Golang
View postgres_array.go
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
@kitsunde
kitsunde / gist:3665628
Created Sep 7, 2012
pytz working for Singapore
View gist:3665628
>>> import pytz
>>> from datetime import datetime
>>> time_zone = pytz.timezone('Asia/Singapore')
>>> my_time = datetime.utcnow()
>>> my_time
datetime.datetime(2012, 9, 7, 12, 6, 15, 56631)
>>> my_time.replace(tzinfo=pytz.utc)
datetime.datetime(2012, 9, 7, 12, 6, 15, 56631, tzinfo=<UTC>)
>>> my_time = my_time.replace(tzinfo=pytz.utc)
>>> my_time.astimezone(time_zone)
@mtigas
mtigas / gist:952344
Last active Sep 10, 2020
Mini tutorial for configuring client-side SSL certificates.
View gist:952344

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

You can’t perform that action at this time.