Skip to content

Instantly share code, notes, and snippets.

View ekka21's full-sized avatar

Ekkachai Danwanichakul ekka21

View GitHub Profile
@ekka21
ekka21 / vim
Created February 1, 2019 17:04
minimal vim setup
#!/bin/bash
set -e
"Installing pathogen
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
"Installing .vimrc
curl -LSso ~/.vimrc https://raw.githubusercontent.com/ekka21/dotfiles/master/.vimrc
#bash prompt with git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
export PATH=~/.local/bin:$PATH
#aliases
alias c='clear'
alias lsa='ls -lah'
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box_check_update = false
config.ssh.insert_key = false
config.vm.box = "geerlingguy/centos7"
gource --user-image-dir .git/avatar/ --seconds-per-day 0.7 --auto-skip-seconds 1 --auto-skip-seconds 1 --hide filenames,mouse,progress -1280x720 -o - | avconv -y -r 30 -f image2pipe -vcodec ppm -i - -b 65536K climate-development.mp4
gource \
-s 1 \
-1280x720 \
--auto-skip-seconds .1 \
--multi-sampling \
--stop-at-end \
--key \
--highlight-users \
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@ekka21
ekka21 / addhost
Last active August 29, 2015 14:10
Add a new /etc/hosts script
#!/bin/bash
echo "127.0.0.1 will be used if IP-Address is blank.";
read -p "IP-Address: " IP_ADDRESS
read -p "Site Name: " SITE_NAME
#Add a new /etc/hosts
if [ -n "$IP_ADDRESS" ]; then
#not empty
sudo -- sh -c "echo ${IP_ADDRESS} ${SITE_NAME} >> /etc/hosts"
@ekka21
ekka21 / gist:5979014
Created July 11, 2013 20:36
Wordpress: add custom meta key to all of the post type
<?php
#domain.com/?run_script=1 to run this script
function add_my_custom_meta_key(){
global $wpdb;
if ($_GET['run_script'] =='1' && !is_admin() )
{
$q = 'SELECT id from wp_posts where post_type = "MY_CUSTOM_POST_TYPE"';
$ids = $wpdb->get_col($q);
foreach($ids as $id)
{
@ekka21
ekka21 / gist:5918840
Last active December 19, 2015 07:29
Pagoda: Boxfile
web1:
document_root: public
php_version: 5.3.10
php_extensions:
- mbstring
- mcrypt
- pdo_mysql
- mysql
- apc
- memcached
@ekka21
ekka21 / gist:5886238
Created June 28, 2013 17:01
sass: mixin
@mixin debug
border: 1px solid red
@mixin hide-txt
overflow: hidden
text-indent: 1500%
white-space: nowrap
@mixin clearfix
&:before,
@ekka21
ekka21 / gist:4665225
Created January 29, 2013 15:47
Wordpress: remove wp logo on admin bar in the backend
function remove_wp_logo( $wp_admin_bar )
{
$wp_admin_bar->remove_node('wp-logo');
}
add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );