Skip to content

Instantly share code, notes, and snippets.

@nodegin
nodegin / nginx-daemon
Created May 14, 2015 09:03
nginx-daemon
[Unit]
Description=nginx
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
TimeoutSec=120
User=root
Group=root
SyslogIdentifier=nginx
@nodegin
nodegin / progress.java
Last active December 20, 2015 09:09
progress bar
// cursor moving
// http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html
static void updateProgress(int currentIndex, int total) {
final int width = 25; // progress bar width in chars
float percentage = (float) currentIndex / (float) total;
int currProgress = (int) Math.floor(percentage * width);
int remainProgress = width - currProgress;
String numCurr = new String(new char[currProgress]).replace("\0", "=");
if (numCurr.length() > 0)
numCurr = numCurr.substring(0, numCurr.length() - 1) + ">";
@nodegin
nodegin / aikon.coffee
Last active December 31, 2015 10:50
aikon core
# aikon core, copyright 2015&+ nodegin, version 3
class Aikon
base: 'https://na.cx/i/'
icons: {}
defc: ['[369]','#adore#','#yup#','O:-)',':-[','#ass#','[banghead]',':document','[bomb]','[bouncer]','[bouncy]','#bye#','[censored]','#cn#',':o)',':~(','xx(',':-]','#ng#','#fire#','[flowerface]',':-(','fuck','@_@','#good#','#hehe#','#hoho#','#kill2#','#kill#','^3^','#love#','#no#','[offtopic]',':O','[photo]','[shocking]','[slick]',':)','[sosad]','#oh#',':P',';-)','???','?_?','[yipes]','Z_Z','#lol#']
defi: ['369', 'adore', 'agree', 'angel', 'angry', 'ass', 'banghead', 'biggrin', 'bomb', 'bouncer', 'bouncy', 'bye', 'censored', 'chicken', 'clown', 'cry', 'dead', 'devil', 'donno', 'fire', 'flowerface', 'frown', 'fuck', '@', 'good', 'hehe', 'hoho', 'kill2', 'kill', 'kiss', 'love', 'no', 'offtopic', 'oh', 'photo', 'shocking', 'slick', 'smile', 'sosad', 'surprise', 'tongue', 'wink', 'wonder2', 'wonder', 'yipes', 'z', 'lol']
init: (data)=>
# add icon buttons
frag = document.createDocumentFragment()
@nodegin
nodegin / base⠼⠋⠙.php
Last active March 8, 2016 14:35 — forked from naoyat/base⠼⠋⠙.py
use braille patterns for base64, instead of alphanumerics. joke.
<?php
function _b64enc($in, $padding = false)
{
$inLen = count($in);
$out = [];
for ($i = 0; $i < $inLen; $i += 3)
{
$out[] = $in[$i] >> 2;
if ($i + 1 < $inLen)
@nodegin
nodegin / raphael.export.min.js
Created April 20, 2016 01:19
Raphael export minified
(function(h){function p(a){if("number"===typeof a)return a.toString();var f={"<":"lt",">":"gt",'"':"quot","'":"apos"},c;for(c in f)a=a.replace(new RegExp(c,"g"),"&"+f[c]+";");return a}function t(a,f){var c=[],b;if("undefined"!=typeof a.unshift){var k=a.length;for(b=0;b<k;b++)if("undefined"!=typeof a[b]){var e=f.call(this,a[b],b);null!==e&&c.push(e)}}else for(b in a)a.hasOwnProperty(b)&&(e=f.call(this,a[b],b),null!==e&&c.push(e));return c}function u(a,f,c){for(var b in a)a.hasOwnProperty(b)&&(c=f.call(this,
c,a[b],b));return c}function r(a,f,c,b){if("undefined"===typeof b||null===b)b="";"object"===typeof f&&(f=t(f,function(a,b){switch(b){case "transform":return;case "fill":if(a.match(/^hsb/)){var c=a.replace(/^hsb\(|\)$/g,"").split(",");3===c.length&&(a=h.hsb2rgb(c[0],c[1],c[2]).toString())}}return b+'="'+p(a)+'"'}).join(" "));return"<"+a+(c?' transform="matrix('+c.toString().replace(/^matrix\(|\)$/g,"")+')" ':" ")+f+">"+b+"</"+a+">"}function w(a){return{font:{family:"undefined"===typeof a.attrs.font?
null:a.a
@nodegin
nodegin / gist:c8971099277ebfb77f61c2a3e13a0c83
Last active April 27, 2016 13:09 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@nodegin
nodegin / geolocation
Last active August 22, 2016 21:19
geolocation
Coordinate to address:
http://maps.googleapis.com/maps/api/geocode/json?latlng=44.4647452,7.3553838&language=en
Parse address:
http://maps.googleapis.com/maps/api/geocode/json?address=xxxx
Distance of meter between 2 coordinates
http://stackoverflow.com/a/11172685
@nodegin
nodegin / default
Created September 14, 2016 19:52
Nginx + phpMyAdmin + Node.js
server {
listen 8080 default_server;
listen [::]:8080 default_server ipv6only=on;
root /home/ubuntu;
index index.php index.html index.htm;
server_name localhost;
location / {
yum -y install bitmap-fonts bitmap-fonts-cjk mkfontscale fontconfig
mkdir /usr/share/fonts/win/
mv msjh.ttf /usr/share/fonts/win
cd /usr/share/fonts/win/
mkfontscale
mkfontdir
fc-cache
@nodegin
nodegin / \Library\LaunchDaemons\com.pf.plist
Last active May 16, 2017 05:27
redirect 80 to 8080 on macOS
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple Computer/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.pf.plist</string>
<key>Program</key>
<string>/sbin/pfctl</string>
<key>ProgramArguments</key>
<array>