Skip to content

Instantly share code, notes, and snippets.

View prasetiyohadi's full-sized avatar

Prasetiyo Hadi Purwoko prasetiyohadi

View GitHub Profile
@prasetiyohadi
prasetiyohadi / iredmail_mailman_aliases.py
Created November 25, 2015 05:19
Insert Mailman domain and aliases to iRedmail MySQL database
#!/usr/bin/env python
import MySQLdb
db = MySQLdb.connect("localhost", "dbuser", "dbpass", "dbname")
cursor = db.cursor()
print "Insert mailman domain and aliases to iRedmail database."
sql = """
select * from domain where domain="lists.example.com"
@prasetiyohadi
prasetiyohadi / vgaoutput.sh
Last active December 23, 2015 09:55
Connect to a VGA output for Arch Linux notebooks
#!/bin/bash
# Arch Linux
# clone desktop
xrandr --auto
# extend desktop
xrandr --output LVDS-1-0 --auto --output VGA-1-0 --auto --right-of LVDS-1-0
@prasetiyohadi
prasetiyohadi / .vimrc
Created November 8, 2015 09:46
My .vimrc file
set nocompatible " required
filetype off " required
filetype plugin indent on " required
" Control split
set splitbelow
set splitright
" Split navigations
@prasetiyohadi
prasetiyohadi / file.sh
Last active December 23, 2015 09:53
Convert file types and optimize PDF file
#!/bin/bash
# using imagemagick package
# convert *.png file to *.jpg file
convert file.png file.jpg
# convert *.jpg file to *.pdf file
convert file.jpg file.pdf
# using ghostscript package
@prasetiyohadi
prasetiyohadi / nginx.conf
Last active December 23, 2015 09:52
nginx proxy configuration for php-fpm, fastcgi, and kibana4
server {
listen 80;
server_name domain.com;
root /usr/share/nginx/html;
try_files $uri =404;
index index.php index.html;
location / {
}
@prasetiyohadi
prasetiyohadi / pacman-fonts.sh
Last active December 23, 2015 09:51
pacman install all fonts except *mate* and *tex* package
#!/bin/bash
sudo pacman -S --needed $(pacman -Ss font | awk -F" " '{print $1}' | grep "/" | awk -F"/" '{print $(NF)}' | grep -v mate | grep -v tex | tr '\n' ' ')
@prasetiyohadi
prasetiyohadi / nginx
Created February 21, 2015 09:46
Nginx init script for passenger nginx module for CentOS 6
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx