Skip to content

Instantly share code, notes, and snippets.

@nndnha
nndnha / Common-Currency.json
Created June 2, 2021 03:50 — forked from ksafranski/Common-Currency.json
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@nndnha
nndnha / web-servers.md
Created May 13, 2021 13:54 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@nndnha
nndnha / dis.sh
Created March 28, 2020 04:16
Sort docker images by size desc
docker images | sort -k7 -h -r
@nndnha
nndnha / Bitmap.js
Created August 1, 2019 01:16 — forked from binarymax/Bitmap.js
Javascript bitmap data structure
//------------------------------------------
//Compact bitmap datastructure
//Memory efficient array of bool flags
var Bitmap = function(size){
this._cols = 8;
this._shift = 3;
this._rows = (size>>this._shift)+1;
this._buf = new ArrayBuffer(this._rows);
this._bin = new Uint8Array(this._buf);
};
#!/usr/bin/env ruby
require 'open-uri'
require 'pathname'
require 'json'
def strip_hash(f)
ext = f.extname
if ext.include?("?")
@nndnha
nndnha / rsa.py
Created February 2, 2018 04:21 — forked from JekaDeka/rsa.py
A simple RSA implementation in Python
'''
620031587
Net-Centric Computing Assignment
Part A - RSA Encryption
'''
import random
'''
@nndnha
nndnha / pixel_gif.py
Created February 1, 2018 04:34 — forked from simonw/pixel_gif.py
Return a 1x1 pixel gif from Django (e.g. for a dynamic tracking pixel)
from django.http import HttpResponse
PIXEL_GIF_DATA = """
R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
""".strip().decode('base64')
def pixel_gif(request):
return HttpResponse(PIXEL_GIF_DATA, content_type='image/gif')
@nndnha
nndnha / function_invocation.js
Created June 19, 2017 03:16 — forked from myshov/function_invocation.js
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@nndnha
nndnha / ReactNativeHTML.js
Created September 28, 2016 05:40 — forked from jsdf/ReactNativeHTML.js
Rendering HTML rich text as React Native <Text> elements
var React = require('react-native')
var {
View,
Text,
LinkingIOS,
StyleSheet,
} = React
// you might want to compile these two as standalone umd bundles
// using `browserify --standalone` and `derequire`