Skip to content

Instantly share code, notes, and snippets.

#!/bin/env python
import yaml
import sys
import json
import argparse
from subprocess import Popen, PIPE
import argparse
import os
# This is a startup script for IPython. It adds a "line magic" helper that
# makes it very easy to run a Twisted reactor in a separate thread.
#
# This script has been tested in Python 2 and Python 3.
#
# Author: Mike Pontillo <pontillo@gmail.com>
#
# INSTRUCTIONS
# ============
# Place this file in: ~/.ipython/profile_default/startup/reactor.py
@atoponce
atoponce / gist:07d8d4c833873be2f68c34f9afc5a78a
Last active July 26, 2024 09:10 — forked from tqbf/gist:be58d2d39690c3b366ad
Cryptographic Best Practices

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@theothermattm
theothermattm / sync-using-gitignore.sh
Created October 7, 2015 20:58
Rsync files using .gitignore
# sync everything excluding things in .gitignore
# delete anything on target not in source
# include dotfiles and symlinks, also use compression
rsync -azP --delete --filter=":- .gitignore" . my-target-host:/my/target/directory
@mprymek
mprymek / encfs-agent
Last active February 25, 2020 14:06
encfs-agent - mount encfs filesystems using ssh-agent
#! /usr/bin/env python2
"""
encfs-agent
Mounts encfs filesystems with passwords generated using private keys stored in ssh-agent.
You can have any number of encrypted filesystems ("vaults") under VAULTS_DIR. Password for
each of them is derived from its name and given private key stored in ssh-agent.
You can use ssh-askpass for ssh-agent if you want.
from twisted.internet import reactor, defer
from twisted.web.http import HTTPChannel
from twisted.application import internet, service
from twisted.web.server import Site, NOT_DONE_YET
from twisted.web.resource import Resource
class SlowResource(Resource):
isLeaf = True
waiting_requests = []
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
int main(int argc, char* argv[])
{
int s;