Skip to content

Instantly share code, notes, and snippets.

View wannadrunk's full-sized avatar

WannaDrunk wannadrunk

  • Earth
View GitHub Profile
@wannadrunk
wannadrunk / wkhtmltopdx4odoo
Last active November 12, 2017 11:12
Note to install wkhtmltopdf for Odoo
apt-get install xfonts-base
apt-get install xfonts-75dpi
Read more, https://github.com/odoo/odoo/wiki/Wkhtmltopdf
rem wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
rem dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
wget http://nightly.odoo.com/extra/wkhtmltox-0.12.1.2_linux-jessie-amd64.deb
wget https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
@wannadrunk
wannadrunk / SysSetting
Created October 28, 2016 05:06
Basic system setting
/bin/echo Asia/Bangkok > /etc/timezone
/bin/rm /etc/localtime
/bin/ln -s /usr/share/zoneinfo/Asia/Bangkok /etc/localtime
## locale
/bin/echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
/bin/echo th_TH.UTF-8 UTF-8 >> /etc/locale.gen
/usr/sbin/locale-gen

wp-config.php

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );

Apache virtual host

<Directory "/var/www/html">
	allow from all
@wannadrunk
wannadrunk / MT-LB-PCC-DynDNS
Last active November 1, 2016 08:51
Mikrotik ทำ LB PCC แล้ว dyndns มีปัญหาเหมือนมันไม่รู้จะใช้ ip ของ wan ไหนเป็นหลัก ผมใช้สคริปตามด้านล่างนี้ไม่ทราบต้องแก้ไขตรงไหนครับ
#---- Change Values in this section to match your setup ----
:local username "username"
:local password "password"
:local hostname "domain.dyndns.org"
:local ddnsinterface "pppoe-out1"
#-----------------------------------------------------------
# get the current ip
:local currentip [ /ip address get [/ip address find interface=$ddnsinterface ] address ]
:local ddnsip [ /resolve domain-name=$hostname ]
@wannadrunk
wannadrunk / Get IP from MAC
Created December 1, 2016 07:00
How to get to know the IP address from the MAC address on Linux command
# arp -n | grep b8:27 | awk '{print $1,$3}'
- sources.list
deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main
# wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

#Error: Database creation error: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as in the template database, or use template0 as template.

##solution

root@server:~# su postgres
postgres@server:~ $ psql -U postgres
psql (9.0.3)
Type "help" for help.
var fs = require('fs')
var express = require('express')
var app = express()
var ejs = require('ejs')
var mongo = require('mongodb')
var client = mongo.MongoClient
var crypto = require('crypto')
var multer = require('multer')
var upload = multer({dest:'./uploads'})
var io = require('socket.io')()

Debian

# /bin/echo Asia/Bangkok > /etc/timezone
# /bin/rm /etc/localtime
# /bin/ln -s /usr/share/zoneinfo/Asia/Bangkok /etc/localtime

## locale
# /bin/echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
# /bin/echo th_TH.UTF-8 UTF-8 >> /etc/locale.gen
# /usr/sbin/locale-gen
@wannadrunk
wannadrunk / robocop.cmd
Created May 17, 2017 14:15
Backup current user profile data to storage which run this script. The script requires robocopy.exe
@Echo off
cls
Echo.
Echo.
Echo.This is going to copy your data from
Echo.
Echo. - "%userprofile%"
Echo.
Echo.to this external device under folder "%computername%"
Echo.