This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <msp430.h> | |
// memory efficient modular exponentiation | |
// | |
// calculate c, where - (b^e) mod m = c | |
// b is the plaintext | |
// e is the secret key | |
// m is phi(n) the totient of the public key, a number derived from the public key components | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4-Bit Counter: | |
74161 - http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?freeText=74161&langId=-1&storeId=10001&productId=49664&search_type=jamecoall&catalogId=10001&ddkey=http:StoreCatalogDrillDownView | |
4-Bit Register (I use two for each 8-bit register): | |
74LS173 - http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?freeText=74LS173&langId=-1&storeId=10001&productId=46922&search_type=jamecoall&catalogId=10001&ddkey=http:StoreCatalogDrillDownView | |
2-1 Multiplexer: | |
74LS157 - http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_46771_-1 | |
16x8 RAM (output needs to be inverted): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# local port forwarding | |
# the target host 192.168.0.100 is running a service on port 8888 | |
# and you want that service available on the localhost port 7777 | |
ssh -L 7777:localhost:8888 [email protected] | |
# remote port forwarding | |
# you are running a service on localhost port 9999 | |
# and you want that service available on the target host 192.168.0.100 port 12340 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!#/usr/bin/env bash | |
sudo diskutil list | |
sudo diskutil unmountDevice /dev/disk3 # could be disk 2 or disk 4, check the list | |
sudo dd if=file.iso of=/dev/rdisk3 bs=16m # again, could be disk2 or disk4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require('assert') | |
var crypto = require('crypto') | |
var fs = require('fs') | |
var alice = crypto.createDiffieHellman(2048) | |
alice.setPrivateKey(fs.readFileSync('../alice.private.pem').toString('hex'),'hex') | |
alice.setPublicKey(fs.readFileSync('../alice.public.pem').toString('hex'),'hex') | |
var bob = crypto.createDiffieHellman(2048) | |
bob.setPrivateKey(fs.readFileSync('../bob.private.pem').toString('hex'),'hex') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body style="width:500px; height:500px;"> | |
<video controls></video> | |
<script src="index.js"></script> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function a(){ | |
var some_variable = 'foo' | |
function foo(){ console.log(some_variable) } | |
return { | |
foo: foo | |
} | |
} | |
a.prototype.__proto__.bar = function(){ console.log('bar') } // the thing standard complains about |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Secure sessions are easy, but it's not very well documented, so I'm changing that. | |
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy: | |
The desired configuration for using NginX as an SSL proxy is to offload SSL processing | |
and to put a hardened web server in front of your Node.js application, like: | |
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [CLIENT] | |
To do this, here's what you need to do: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MONGO_DATABASE="your_db_name" | |
APP_NAME="your_app_name" | |
MONGO_HOST="127.0.0.1" | |
MONGO_PORT="27017" | |
TIMESTAMP=`date +%F-%H%M` | |
MONGODUMP_PATH="/usr/bin/mongodump" | |
BACKUPS_DIR="/home/username/backups/$APP_NAME" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
palette="palette.png" | |
filters="fps=5,scale=720:-1:flags=lanczos" | |
# ffmpeg -start_number 33736 -i G00%05d.JPG -r 3 -resize 50% output.gif | |
ffmpeg -v warning -start_number 33736 -i G00%05d.JPG -vf "$filters,palettegen" -y $palette | |
ffmpeg -v warning -start_number 33736 -i G00%05d.JPG -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y output.gif |