Skip to content

Instantly share code, notes, and snippets.

View songpon's full-sized avatar

Songpon Phusing songpon

View GitHub Profile
@songpon
songpon / csv2xlsx.py
Last active January 15, 2018 15:38
convert csv to xlsx
#!/usr/bin/env python3
import sys
import csv
import xlsxwriter
"""
requirements:
pip install xlsxwriter
pip install progressbar2
usage:
@songpon
songpon / do-dns.sh
Last active February 10, 2018 14:56
Digital Ocean update my dns record
#!/bin/bash
domain=example.com
token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#get record_id from this command
#curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $api" "https://api.digitalocean.com/v2/domains/$domain/records"
record_id=88888888
current_ip="$(\
@songpon
songpon / install-mongodb-ubuntu-16.04.sh
Created March 29, 2018 03:12
ubuntu 16.04 install mongodb
sudo apt install apt-transport-https
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install -y mongodb-org
import os
import datetime
import glob
def modification_date(filename):
t = os.path.getmtime(filename)
return datetime.datetime.fromtimestamp(t)
files = glob.glob('*')
# Reference
# https://www.linuxcloudvps.com/blog/how-to-install-odoo-10-on-ubuntu-16-04-with-nginx-as-a-reverse-proxy/
# https://linuxize.com/post/configure-odoo-with-nginx-as-a-reverse-proxy/
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoo-chat {
server 127.0.0.1:8072;
# Reference
# https://www.linuxcloudvps.com/blog/how-to-install-odoo-10-on-ubuntu-16-04-with-nginx-as-a-reverse-proxy/
# https://linuxize.com/post/configure-odoo-with-nginx-as-a-reverse-proxy/
# https://gist.github.com/plentz/6737338
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoo-chat {
#!/bin/bash
MASTER_IP=
SLAVE_IP=
# service postgresql stop
su - postgres
psql -c "CREATE ROLE replica WITH PASSWORD 'myreplpassword' LOGIN REPLICATION;"
#Security for master allow standby access
# https://raw.githubusercontent.com/tony/tmux-config/master/.tmux.conf
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-style bg=colour235,fg=colour136,default # bg=base02, fg=yellow
#crontab reboot need to use bash
set-option -g default-shell /bin/bash
# set window split
bind-key v split-window -h
@songpon
songpon / .gitignore_global
Created November 4, 2019 09:24
my git ignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.jasper
ls *.MP4 > input.txt
sed -i 's/^/file /g' input.txt
~/ffmpeg-20191114-73ee53f-win64-static/bin/ffmpeg.exe -f concat -i input.txt -c copy output.mp4
rm input.txt