Skip to content

Instantly share code, notes, and snippets.

View junlapong's full-sized avatar
🏚️
Work from home

Junlapong L. junlapong

🏚️
Work from home
  • Ratchaburi, Thailand
View GitHub Profile
@junlapong
junlapong / _nginx-config.md
Last active June 14, 2019 01:17 — forked from plentz/nginx.conf
nginx

NGINX

/etc/init.d/nginx start|restart|reload

CONFIG

/ect/nginx/nginx.conf
@junlapong
junlapong / luhn.js
Last active August 29, 2015 14:23 — forked from ShirtlessKirk/luhn.js
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,
@junlapong
junlapong / vereq.xml
Last active August 29, 2015 14:23 — forked from x2q/vereq.xml
<?xml version="1.0" encoding="UTF-8"?>
<ThreeDSecure>
<Message id="999">
<VEReq>
<version>1.0.2</version>
<pan>4444333322221111</pan>
<Merchant>
<acqBIN>411111</acqBIN>
<merID>99000001</merID>
<password>99000001</password>
import java.net.InetAddress;
import java.net.UnknownHostException;
public class IPRangeChecker {
public static long ipToLong(InetAddress ip) {
byte[] octets = ip.getAddress();
long result = 0;
for (byte octet : octets) {
result <<= 8;
@junlapong
junlapong / ldif-to-csv.sh
Created September 23, 2015 03:48 — forked from dansimau/ldif-to-csv.sh
Shell script that reads LDIF data from STDIN and outputs as CSV.
#!/bin/bash
#
# Converts LDIF data to CSV.
# Doesn't handle comments very well. Use -LLL with ldapsearch to remove them.
#
# 2010-03-07
# [email protected]
#
# Show usage if we don't have the right params
@junlapong
junlapong / server-git.conf
Created October 23, 2015 12:19 — forked from massar/server-git.conf
Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# [email protected] - http://jeroen.massar.ch
server {
listen 192.0.1.1:80;
listen [2001:db8::1]:80;
# Redirect all non-HTTPS traffic to the HTTPS variant
return 301 https://$host$request_uri;
}

การใช้ Git ฉบับรีบร้อน

Git เป็น Version Control System แบบ distributed (หมายความว่าไม่มีศูนย์กลาง) และแบบ non-linear history (หมายความว่ามีประวัติการเปลี่ยนแปลงแบบไม่ใช่เส้นตรง) ดังนั้นทำให้คอนเซปต์ของ Git นั้นต่างจาก VCS รุ่นก่อนหน้าหลายอย่าง

ต่อไปจะอธิบายย่อๆ เรื่องคำสั่ง Git โดยอิงกับการทำงานใน GitHub เป็นสำคัญ

Configurations

@junlapong
junlapong / API.md
Created August 18, 2017 15:06 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@junlapong
junlapong / gist:9cc429ace6b9aa52ca9bbb85969624c2
Created September 22, 2017 01:32 — forked from ishikawa/gist:88599
Java Sample Code for Calculating HMAC-SHA1 Signatures
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Formatter;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
/**
@junlapong
junlapong / GeneratePublicPrivateKeys.java
Last active October 28, 2017 13:49 — forked from liudong/gist:3993726
Java: Generate Public/Private Keys
import java.security.KeyPairGenerator;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.KeyFactory;
import java.security.spec.EncodedKeySpec;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.security.spec.InvalidKeySpecException;
import java.security.NoSuchAlgorithmException;