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
public class BijectiveUtils { | |
private static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
private static final int BASE = 62; | |
public static String encode(int num) { | |
StringBuilder sb = new StringBuilder(); | |
while ( num > 0 ) { | |
sb.append( ALPHABET.charAt( num % BASE ) ); |
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
# scp -r [folder] [user]@[IPAddress]:`pwd` |
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
package io.stalk.gae.html; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
import java.nio.charset.Charset; | |
import javax.servlet.http.*; |
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
### cmd.sh | |
#!/bin/sh | |
HOSTLIST=hostlist.dat | |
if [ ! -n "$1" ] | |
then | |
echo "usage: $0 \"command arg1 arg2 ... \"" | |
exit 1 | |
fi | |
for i in `cat ~/$HOSTLIST` |
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
# Install with brew | |
$ brew install nginx | |
# After install run: | |
$ sudo nginx | |
# Test it by going to URL: http://localhost:8080 | |
# Configuration |
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
# Login by root !!!!!! | |
# change root password | |
> passwd | |
# create npush user account | |
> adduser npush | |
> visudo | |
npush ALL=(ALL:ALL) ALL # add root privileges for npush user |
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
# Our .tmux.conf file | |
# Setting the prefix from C-b to C-a | |
# START:prefix | |
set -g prefix C-a | |
# END:prefix | |
# Free the original Ctrl-b prefix keybinding | |
# START:unbind | |
unbind C-b | |
# END:unbind |
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
npm install -g grunt-cli | |
npm install -g grunt-init | |
git clone https://github.com/gruntjs/grunt-init-jquery.git ~/.grunt-init/jquery | |
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
function makeRequest(method, url, params, fnLoad) { | |
var xhr = new XMLHttpRequest(); | |
if ("withCredentials" in xhr) { | |
// XHR for Chrome/Firefox/Opera/Safari. | |
xhr.open(method, url, true); | |
} else if (typeof XDomainRequest != "undefined") { | |
// XDomainRequest for IE. | |
xhr = new XDomainRequest(); | |
xhr.open(method, url); | |
} else { |
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
public class BijectiveUtils { | |
private static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
private static final int BASE = 62; | |
public static String encode(int num) { | |
StringBuilder sb = new StringBuilder(); | |
while ( num > 0 ) { | |
sb.append( ALPHABET.charAt( num % BASE ) ); |
OlderNewer