Skip to content

Instantly share code, notes, and snippets.

View bylatt's full-sized avatar

Lattapon Yodsuwan bylatt

  • Bangkok, Thailand
View GitHub Profile
@bylatt
bylatt / batt.sh
Created October 24, 2015 17:45
Show battery status on mac os x
#!/bin/bash
percent=$(pmset -g batt | egrep "([0-9]+\%).*" -o | cut -f1 -d'%')
args=("$@")
if [ "${args[0]}" == "debug" ]; then
echo "$percent"
fi
if [ "$percent" -gt "80" ]; then
# sample nginx config
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php index.html index.htm;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
@bylatt
bylatt / tfac.rb
Last active November 26, 2015 16:57
Simple ruby script to get wikipedia today's featured article
#!/usr/bin/env ruby
require "nokogiri"
require "open-uri"
wiki_url = "https://en.wikipedia.org/wiki/Main_Page"
doc = Nokogiri::HTML(open(wiki_url))
article = doc.at_css("div#mp-tfa i:first-child a")
@bylatt
bylatt / quick_wordpress.sh
Created January 3, 2016 13:24
Quickly start wordpress site with docker
docker run --name mysql -e MYSQL_ROOT_PASSWORD=1234 -d mysql
docker run --name wordpress --link mysql:mysql -p 80:80 -d wordpress

Settings for Atom text editor.

infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $TERM.ti
tic $TERM.ti
class FizzBuzz:
def __init__(self, number):
if FizzBuzz.is_valid_number(number):
self.number = number
@property
def result(self):
if FizzBuzz.is_divide_by(self.number, (3 * 5)):
return "FizzBuzz"
elif FizzBuzz.is_divide_by(self.number, 3):
" File: ltp256.vim
" Maintainer: Lattapon Yodsuwan (clozed2u)
" URL: https://github.com/clozed2u
" Base: {{{
" The following are the preferred 16 colors for your terminal
" Color Normal Bright
"
" Black #4E4E4E #7C7C7C

Build php 7.0 manually on macOS High Sierra

Install dependencies using homebrew

brew install autoconf automake gd icu4c libtool mcrypt openssl

Run configure script with these options

./configure \