Skip to content

Instantly share code, notes, and snippets.

@jeanmonet
jeanmonet / nginx.conf
Created July 30, 2019 18:55 — forked from kylemcdonald/nginx.conf
nginx config for port forwarding to a Jupyter instance on localhost.
user www-data;
worker_processes auto;
pid /run/nginx.pid;
## based on https://gist.github.com/cboettig/8643341bd3c93b62b5c2
events {
worker_connections 1024;
}
@jeanmonet
jeanmonet / js-crypto-libraries.md
Created April 4, 2020 12:35 — forked from jo/js-crypto-libraries.md
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

I start with a list and plan to create a comparison table.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

@jeanmonet
jeanmonet / Encryption.js
Created April 5, 2020 14:35 — forked from ve3/Encryption.js
Encrypt and decrypt between programming languages (PHP & JavaScript).
/**
* Encryption class for encrypt/decrypt that works between programming languages.
*
* @author Vee Winch.
* @link https://stackoverflow.com/questions/41222162/encrypt-in-php-openssl-and-decrypt-in-javascript-cryptojs Reference.
* @link https://github.com/brix/crypto-js/releases crypto-js.js can be download from here.
*/
class Encryption {
<?php
require_once('Crypto.php');
function setKey(){
try {
$key = Crypto::CreateNewRandomKey();
// WARNING: Do NOT encode $key with bin2hex() or base64_encode(),
// they may leak the key to the attacker through side channels.
} catch (CryptoTestFailedException $ex) {
die('Cannot safely create a key');
} catch (CannotPerformOperationException $ex) {
@jeanmonet
jeanmonet / aes-cbc.py
Created April 11, 2020 17:57 — forked from lopes/aes-cbc.py
Simple Python example of AES in CBC mode.
#!/usr/bin/env python3
#
# This is a simple script to encrypt a message using AES
# with CBC mode in Python 3.
# Before running it, you must install pycryptodome:
#
# $ python -m pip install PyCryptodome
#
# Author.: José Lopes
# Date...: 2019-06-14
# VPN Namespace
# Uploaded to Gist by JimboMonkey1234
OS: Arch Linux
VPN: PIA/Mullvad
Requires: openvpn, openvpn-update-resolv-conf
Goals:
1) Force Deluge to use a VPN while leaving all other programs unaffected
2) Introduce a killswitch to prevent Deluge from using anything other than the VPN
import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
print('Hello!')
if __name__ == '__main__':
loop.run_until_complete(hello())
@jeanmonet
jeanmonet / aproducer.py
Created April 19, 2020 15:45 — forked from dabeaz/aproducer.py
"Build Your Own Async" Workshop - PyCon India - October 14, 2019 - https://www.youtube.com/watch?v=Y4Gt3Xjd7G8
# aproducer.py
#
# Async Producer-consumer problem.
# Challenge: How to implement the same functionality, but no threads.
import time
from collections import deque
import heapq
class Scheduler:
@jeanmonet
jeanmonet / europython-2018.md
Created April 20, 2020 21:58 — forked from rupert/europython-2018.md
EuroPython 2018
@jeanmonet
jeanmonet / router.py
Created April 26, 2020 18:48 — forked from anopheles/router.py
Router Dealer example with bidirectional communication
# encoding: utf-8
import zmq
from collections import defaultdict
context = zmq.Context()
client = context.socket(zmq.ROUTER)
client.bind("tcp://*:5556")
poll = zmq.Poller()