Skip to content

Instantly share code, notes, and snippets.

View stilldavid's full-sized avatar
💽
minidisc'in

David Stillman stilldavid

💽
minidisc'in
View GitHub Profile
@thcipriani
thcipriani / vigenère_cipher.py
Created February 17, 2017 15:55
Simple python implementation of the Vigenère Cipher as described by https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher#Description
#!/usr/bin/env python3
"""
Vigenère Cipher
===============
This is a slightly more complicated version of the classic Ceaser cipher (A.K.A
Rot13). Rather than rotate each letter of the alphabet 13 characters, we rotate
each letter of a message by the offset of the cooresponding letter of a
variable length key.
@mattiaslundberg
mattiaslundberg / Ansible Let's Encrypt Nginx setup
Last active April 19, 2024 16:03
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@mobleyc
mobleyc / http_get.go
Created October 5, 2015 01:06
Creating a custom HTTP Transport and Client with Go
package main
import (
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
"time"
)
@tbarbugli
tbarbugli / How to build a notification feed.md
Last active October 17, 2021 20:13 — forked from tschellenbach/notify_tut.md
How to build a notification feed using Stream

How to build a notification feed using Stream

Introduction

In this tutorial we are going to show how easy it is to build a notification feed using GetStream.io. First of all, let's quickly introduce you to our fictional example app. It's called bug-your-friends.com and allows you interact with your friends, ping them, follow them or poke them. Here's a quick list of example interactions:

  • poke another user (eg. Thierry pokes Alessandra)
  • follow a user (eg. Tommaso follows Iris)
  • ping a user (eg. Josie pings Carolina)

Whenever a user is part of one of these interactions, we want to update his notification feed, update the number of unseen and unread

@nickretallack
nickretallack / env.py
Last active March 16, 2023 20:57
How to run multi-tenant migrations in alembic.
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool, MetaData, Table, ForeignKeyConstraint
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
package main
import (
"io"
"log"
"os"
"os/exec"
"io/ioutil"
"bytes"
)
@kageurufu
kageurufu / flask.py
Created October 3, 2013 17:42
Flask-WTF FieldLists with Dynamic Entries
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.wtf import Form
from flask.ext.babel import gettext
from wtforms import SelectField, TelField, TextField, FormField, Fieldlist, SubmitField
from wtforms.validators import Optional, Required
app = Flask(__name__)
db = SQLAlchemy(app)
@adharris
adharris / postgres_array.go
Created November 28, 2012 19:52
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
@benlemasurier
benlemasurier / gist:1687218
Created January 27, 2012 05:36
stormfs homebrew test
require 'formula'
class Stormfs < Formula
url 'https://github.com/downloads/benlemasurier/stormfs/stormfs-0.01.tar.gz'
homepage 'https://github.com/benlemasurier/stormfs'
md5 '440ceda482e5b5e747217847fe8a9df6'
depends_on 'pkg-config'
depends_on 'fuse4x-kext'
depends_on 'fuse4x'