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
var string = "Sawasdee --> สวัสดี"; | |
var crypto = require('crypto'); | |
crypto.createHash('md5').update(string, 'utf8').digest("hex"); |
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
/* | |
Tampermonkey script for pantip.com | |
This is my white theme for pantip topic page. Useful for me while reading it. | |
## How to use? | |
1. Install tampermonkey chrome extension (https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo) | |
2. Refresh this page | |
3. Open any pantip topic page | |
*/ |
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 main | |
import ( | |
"fmt" | |
"math" | |
) | |
func Sqrt(x float64) float64 { | |
z := 1.0 | |
// var a,b,c,d,e float64 |
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 main | |
import ( | |
"net/http" | |
"log" | |
) | |
func main() { | |
log.Println("Static server listening on port 5555...") | |
http.ListenAndServe(":5555", http.FileServer(http.Dir("D:/dev/static"))) |
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
for /r "C:\tmp\DCIM" %x in (*.jpg) do move "%x" "C:\tmp\pic" |
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
// ref: http://stackoverflow.com/questions/1184334/get-number-days-in-a-specified-month-using-javascript | |
// ref: http://stackoverflow.com/questions/16353211/check-if-year-is-leap-year-in-javascript | |
function daysInMonth(year, month) { | |
var isLeapYeaer = new Date(year, 1, 29).getMonth() == 1; | |
return [31, (isLeapYeaer ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; | |
} |
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 | |
fn=$1 | |
if [ "$2" == "" ] || [ "$3" == "" ]; then | |
if [ -f last_${fn}.txt ]; then | |
value=$(<last_${fn}.txt) | |
_yy=${value:0:4} | |
_mm=${value:4:2} | |
echo "$_yy $_mm" |
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
var el = document.getElementsByTagName('input'); | |
for (var i=0; i<el.length; i++) { el[i].checked = true; } |
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
-- This is a Hive program. Hive is an SQL-like language that compiles | |
-- into Hadoop Map/Reduce jobs. It's very popular among analysts at | |
-- Facebook, because it allows them to query enormous Hadoop data | |
-- stores using a language much like SQL. | |
-- Our logs are stored on the Hadoop Distributed File System, in the | |
-- directory /logs/randomhacks.net/access. They're ordinary Apache | |
-- logs in *.gz format. | |
-- | |
-- We want to pretend that these gzipped log files are a database table, |
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 ubuntu 14.04.4 | |
install software update | |
### disable guest login | |
-- http://askubuntu.com/questions/451526/removing-guest-session-at-login-in-ubuntu-14-04 | |
sudo sh -c "echo 'allow-guest=false' >> /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf" | |
# tahoma as system font | |
download http://www.mediafire.com/download/zjk13nnyizd/tahoma_font.zip | |
extract |
OlderNewer