This file contains 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
random = function(length) { | |
var base = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.split(''); | |
var array = new Uint8Array(length); | |
window.crypto.getRandomValues(array); | |
var str = ''; | |
for (var i = 0; i < array.length; i++) { | |
str += base[array[i]%base.length]; | |
}; | |
return str; | |
} |
This file contains 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
random = function(length) { | |
var array = new Uint16Array(length); | |
window.crypto.getRandomValues(array); | |
var str = ''; | |
for (var i = 0; i < array.length; i++) { | |
str += String.fromCharCode(array[i]); | |
}; | |
return str; | |
} |
This file contains 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/python3.4 | |
# requires pgpy >=0.4.0 (latest, as of 06/30/2016) | |
import pgpy | |
from pgpy.constants import PubKeyAlgorithm, KeyFlags, HashAlgorithm, SymmetricKeyAlgorithm, CompressionAlgorithm | |
class Encryption: | |
@staticmethod | |
def get_key(name, plain=False): | |
try: | |
key = pgpy.PGPKey.from_file('{}.asc'.format(name))[0] |
This file contains 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 | |
read request | |
TOKEN='secret token from gitlab' # from https://gitlab.com/{user}/{project}/settings/integrations | |
HAS_TOKEN=0 | |
while /bin/true; do | |
read header | |
[[ "$header" =~ 'X-Gitlab-Token' ]] && [[ "$header" =~ $TOKEN ]] && HAS_TOKEN=1; | |
[[ "$header" == $'\r' ]] && break; | |
done |
This file contains 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 | |
export DEV_IN=wlan0; | |
ifconfig $DEV_IN down; | |
/etc/init.d/hostapd stop | |
/etc/init.d/dnsmasq stop | |
iptables -Z | |
iptables -F | |
iptables -X | |
ifconfig $DEV_IN up; |