Skip to content

Instantly share code, notes, and snippets.

Andrei deiu

Block or report user

Report or block deiu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View blockstack
Verifying my Blockstack ID is secured with the address 1JrhP8a5KrSmS7uCreg4JVaR7R7Qn7nFqG https://explorer.blockstack.org/address/1JrhP8a5KrSmS7uCreg4JVaR7R7Qn7nFqG
@deiu
deiu / local-ip-check
Last active Dec 6, 2017
ES6 regex function to check if an origin (URL) is on the local network
View local-ip-check
/**
* Check if an (origin) URL is local based on the RFC 1918 list of reserved
* addresses. It accepts http(s) and ws(s) schemas as well as port numbers.
*
* localhost
* 127.0.0.0 – 127.255.255.255
* 10.0.0.0 – 10.255.255.255
* 172.16.0.0 – 172.31.255.255
* 192.168.0.0 – 192.168.255.255
* + extra zero config range on IEEE 802 networks:
View Public SSH key @nayu
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8uEYNRF4530cKXkwkXl/AJv0XL+ydqmk0fvrs+5oAZNTSByvotjsYga9fj38Fc+nuKxTaUMnUzxZ5qUQxWJGB0cQ86/PoKU7jpuOf1w8NnZJE6CjdAthcZXnexLneGvbobUuFa7tOjQ+EtC6WpmeintPK7q+CuazUrAKfLHUjDVC5xDlZMfieXfpgFDW5GNOmkIhk6TBLrjqBnCPYXiaXLS+5Nf1Gba16noinNpGnL0++zmrBPUQ9E1WlYpkkbywoyOEERCvRjYaeUrrmswAJABAsaK1UB1Vf0p/EbkDpMGB8SNKyKxFgi23aYFndWH8unMAAndqwsqO+hM692slv deiu@nayu
View keybase.md

Keybase proof

I hereby claim:

  • I am deiu on github.
  • I am deiu (https://keybase.io/deiu) on keybase.
  • I have a public key whose fingerprint is E131 FAB4 EF64 A8AF 7A65 586C F708 8195 C4AE 512D

To claim this, I am signing this object:

@deiu
deiu / queryVals.js
Created Jun 14, 2016
Parse a URL to map query parameters to their values
View queryVals.js
// Map URL query items to their values
// e.g. ?referrer=https... -> queryVals[referrer] returns 'https...'
var queryVals = (function (a) {
if (a === '') return {}
var b = {}
for (var i = 0; i < a.length; ++i) {
var p = a[i].split('=', 2)
if (p.length === 1) {
b[p[0]] = ''
} else {
View gist:6773a5840ae027918a79
Verifying that +deiu is my openname (Bitcoin username). https://onename.com/deiu
@deiu
deiu / webcryptoapi.html
Last active May 1, 2019
Web Crypto API example: RSA keygen & export & import & sign & verify & encrypt & decrypt
View webcryptoapi.html
<!-- MIT License -->
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
@deiu
deiu / linkheaderparser.js
Last active May 15, 2019
Parse HTTP Link header in Javascript
View linkheaderparser.js
// parse a Link header
//
// Link:<https://example.org/.meta>; rel=meta
//
// var r = parseLinkHeader(xhr.getResponseHeader('Link');
// r['meta'] outputs https://example.org/.meta
//
function parseLinkHeader(header) {
var linkexp = /<[^>]*>\s*(\s*;\s*[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g;
var paramexp = /[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g;
@deiu
deiu / deploy.sh
Last active Dec 25, 2015
RWW.IO Web app deployer
View deploy.sh
#!/bin/sh
# RWW.IO Web app deployer. Simply run `sh deploy.sh` inside your Web app dir and follow the steps.
CERTCMD=""
# get target URI
read -p "Please provide the URI of the target dir (ex: http://example.org/apps/myapp/): " HOST
if [ "$HOST" = "" ]
then
You can’t perform that action at this time.