Skip to content

Instantly share code, notes, and snippets.

@toolness
toolness / gencert.py
Last active June 22, 2023 11:52
Python script to create server SSL certs and sign them with a custom CA.
#! /usr/bin/python
"""
This simple script makes it easy to create server certificates
that are signed by your own Certificate Authority.
Mostly, this script just automates the workflow explained
in http://www.tc.umn.edu/~brams006/selfsign.html.
Before using this script, you'll need to create a private
import os
from flask import Flask, Blueprint, g
api = Blueprint('api', __name__)
class Server(object):
def __init__(self, data):
self.data = data
@sparrc
sparrc / phabricator_readme.md
Last active March 25, 2024 05:59
Phabricator Ubuntu Installation Guide

Phabricator Ubuntu Installation Guide

This is a supplement to the official Phabricator Installation Guide, because their guide will leave you with all kinds of permission and config errors and ~15,000 setup issues on startup.

Install bonus packages:

# apt-get install mercurial subversion python-pygments sendmail imagemagick

Create necessary users and add phd-user to sudoers:

@KatiRG
KatiRG / flask_gunicorn_app.py
Last active January 22, 2024 06:00
Running Flask with Gunicorn
# This gist shows how to integrate Flask into a
# custom Gunicorn-WSGI application described
# here: http://docs.gunicorn.org/en/stable/custom.html
from __future__ import unicode_literals
import multiprocessing
import gunicorn.app.base
@marcopaga
marcopaga / lets-encrypt-wildcard-certs-using-azure-dns-on-aks.md
Last active November 2, 2022 09:52
Let's encrypt wildcard TLS certificates for Azure DNS using cert-manager on AKS (Azure Kubernetes Service)

This gist will guide you through the setup of a wildcard Let's encrypt TLS certificate.

Let's encrypt

Let’s encrypt is one of a new kind of Certificate Authority. You can get a TLS certificate from them for your website free of charge and without any manual overhead. These certificates are trusted in most browsers that are out there and will show up as valid. Instead of sending Mails or even paper around you can call an API and prove your domain ownership with simple challenges. Basically you call the API with a hostname or domain name you need a TLS certificate for and you get back a challenge string that you need to put in a well known location on your http host or as a txt record in your dns system.

The little helper for Kubernetes: Cert-Manager

You can find many clients that manage the proces

@kurtharriger
kurtharriger / types.d.ts
Last active December 31, 2022 16:34
Inferred Workflowy API
type ProjectId = string; // eg: 2a13b3e1-7a74-3b2b-9758-1b398845a8e8
type UserId = number;
type ShareId = string;
type ClientId = string;
// login
// response sessionid returned in set-cookie
// curl -X POST https://workflowy.com/accounts/login/ -F 'username=<username>' -F'password=<password>' -H 'accept: application/json' -D -
export interface LoginFormData {
username: string;
@rtyley
rtyley / AppOnlyAuthentication.scala
Created February 19, 2019 15:35
Hack to make twitter4s support Application-only ('bearer') authentication for higher quota limits
package com.danielasfregola.twitter4s
import java.net.URLEncoder
import akka.actor.ActorSystem
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.model.headers._
import akka.stream.{ActorMaterializer, Materializer}
import com.danielasfregola.twitter4s
import com.danielasfregola.twitter4s.entities.{AccessToken, ConsumerToken}
@myDisconnect
myDisconnect / ClassUtils.scala
Last active April 10, 2022 17:21 — forked from carymrobbins/pretty-print.scala
Pretty print Scala case classes and other data structures.
/*
* Original author's work: @see https://gist.github.com/carymrobbins/7b8ed52cd6ea186dbdf8
* - 2019-07-18 Added support for Option and Map types
* - 2019-11-25 Fixed Option types spacing
*/
object ClassUtils {
/**
* Pretty prints a Scala value similar to its source represention.
* Particularly useful for case classes.