Skip to content

Instantly share code, notes, and snippets.

View slaveofcode's full-sized avatar
🎯
Debugging

Aditya Kresna Permana slaveofcode

🎯
Debugging
View GitHub Profile

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@slaveofcode
slaveofcode / Install-php7.md
Created October 17, 2016 04:47 — forked from hollodotme/Install-php7.md
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@slaveofcode
slaveofcode / Simple nginx.conf with prerender
Last active October 19, 2016 04:08
My simple nginx configuration used for aroound.com prerender
server{
listen 80;
server_name aroound.com;
return 301 http://www.aroound.com$request_uri;
}
server {
listen 80 default_server;
server_name www.aroound.com;
server_tokens off;
@slaveofcode
slaveofcode / postgres-new-user-and-database.txt
Created October 18, 2016 16:35
Create a new role/user and database, then assign the user into the database in postgres
# Create a new user on linux first
>> adduser aditya
# Change the password
>> passwd aditya
# Login as root and go into psql
>> su - root
# Login as postgres user
@slaveofcode
slaveofcode / users.sh
Created October 18, 2016 16:37
Basic user operations on a Linux box
# add user to linux and create home directory (remember to change SHELL in /etc/passwd)
useradd -m USER
# set password
passwd USER
# add to extra groups, no change on primary
usermod -a -G GROUP1,GROUP2 USER
# list groups a user belongs to
@slaveofcode
slaveofcode / solution.txt
Created October 18, 2016 17:13
In case you have a problem when installing psycopg2 on centos which using python 3.4
# install these libs
sudo yum install python34-devel
# install postgresql devel
sudo yum install postgresql-devel
# or with version
sudo yum install postgresql93-devel
@slaveofcode
slaveofcode / slack_notification.php
Created December 5, 2016 08:34 — forked from alexstone/slack_notification.php
Fire a Slack Notification via CURL
<?php
// (string) $message - message to be passed to Slack
// (string) $room - room in which to write the message, too
// (string) $icon - You can set up custom emoji icons to use with each message
public static function slack($message, $room = "engineering", $icon = ":longbox:") {
$room = ($room) ? $room : "engineering";
$data = "payload=" . json_encode(array(
"channel" => "#{$room}",
"text" => $message,
@slaveofcode
slaveofcode / mediaqueries.css
Created December 11, 2016 17:10 — forked from phuphighter/mediaqueries.css
Semantic UI friendly media queries
/* Mobile */
@media only screen and (max-width: 767px) {
[class*="mobile hidden"],
[class*="tablet only"]:not(.mobile),
[class*="computer only"]:not(.mobile),
[class*="large screen only"]:not(.mobile),
[class*="widescreen only"]:not(.mobile),
[class*="or lower hidden"] {
display: none !important;
}
@slaveofcode
slaveofcode / gist:6c143e9759d692b62821a1c32f6692b0
Created February 18, 2017 18:45 — forked from yograterol/gist:99c8e123afecc828cb8c
"gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory" workaround
"gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory" CentOS's and Fedora +22 workaround
Install `redhat-rpm-config`
$ sudo dnf install redhat-rpm-config
@slaveofcode
slaveofcode / install.sh
Last active March 22, 2019 00:48 — forked from marklit/install.sh
Bot Detection Script. Works with Apache and Nginx Log Files. Based on this article http://tech.marksblogg.com/detect-bots-apache-nginx-logs.html
sudo apt-get update
sudo apt-get install \
python-dev \
python-pip \
python-virtualenv
virtualenv findbots
source findbots/bin/activate
curl -O http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz