Skip to content

Instantly share code, notes, and snippets.

View thapakazi's full-sized avatar
💭
🐧 🗡️ 💻

Milan Thapa thapakazi

💭
🐧 🗡️ 💻
View GitHub Profile
@thapakazi
thapakazi / git_create_orphan.sh
Created June 6, 2017 05:30 — forked from seanbuscay/git_create_orphan.sh
Create an orphan branch in a repo.
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name
@thapakazi
thapakazi / configure_docker0.sh
Created April 6, 2017 04:08 — forked from kamermans/configure_docker0.sh
Change the IP subnet of Docker's docker0 interface
#!/bin/sh -e
#
# You can run this script directly from github as root like this:
# curl -sS https://gist.githubusercontent.com/kamermans/94b1c41086de0204750b/raw/configure_docker0.sh | sudo bash -s - 192.168.254.1/24
#
# * Make sure you replace "192.168.254.0/24" with the network that you want to use
#
# NOTE: This script is intended for Debian / Ubuntu only!
if [ $# -lt 1 ]; then
## credit: http://fabian-affolter.ch/blog/the-lineinfile-module-of-ansible/
---
- hosts: alpine_install
user: root
tasks:
# - name: create a complete empty file
# command: /usr/bin/touch /test/test.conf
- name: create a new file with lineinfile
@thapakazi
thapakazi / postgres_table_row_count.sql
Created March 23, 2017 11:34
Row counts for all tables in a postgres db.
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
@thapakazi
thapakazi / cgroups.sh
Created January 8, 2017 08:50 — forked from arsham/cgroups.sh
Wroking with cgroups
# Taken from here: https://wiki.archlinux.org/index.php/cgroups
# You need: libcgroup and cgmanager apps.
# Then start the daemon:
sudo systemctl start cgmanager.service
# Creating the group
sudo cgcreate -a arsham:users -t arsham:users -g memory,cpu:GROUP_NAME
@thapakazi
thapakazi / gist:823ad2a1160af75876ea0ecb2c2ab78c
Created September 27, 2016 12:50 — forked from ipedrazas/gist:2c93f6e74737d1f8a791
List Docker Container Names and IPs
function drips(){
docker ps -q | xargs -n 1 docker inspect --format '{{ .NetworkSettings.IPAddress }} {{ .Name }}' | sed 's/ \// /'
}
@thapakazi
thapakazi / mongodb_3.2.x_security.md
Created September 3, 2016 02:48 — forked from leommoore/mongodb_3.2.x_security.md
MongoDB 3.2.x Security

#MongoDB 3.2.x Security

##Network Ports The standard ports used by mongo are:

ProcessRoleDefault Port
@thapakazi
thapakazi / 20-synaptics.conf
Created May 16, 2016 18:47 — forked from Olical/20-synaptics.conf
Some configuration for Arch Linux on a Dell XPS 13 9350
Section "InputClass"
Identifier "touchpad"
Driver "synaptics"
MatchIsTouchpad "on"
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "VertEdgeScroll" "on"
Option "VertTwoFingerScroll" "on"
Option "HorizEdgeScroll" "on"
@thapakazi
thapakazi / app.go
Created April 25, 2016 15:42 — forked from sanatgersappa/app.go
Web app written in Go to demonstrate handling multiple file uploads.
package main
import (
"html/template"
"io"
"net/http"
"os"
)
//Compile templates on start
@thapakazi
thapakazi / formatted
Created April 25, 2016 11:29 — forked from marcellodesales/formatted.sh
One-liner REST server using netcat - nc
rm -f out
mkfifo out
trap "rm -f out" EXIT
while true
do
cat out | nc -l 1500 > >( # parse the netcat output, to build the answer redirected to the pipe "out".
export REQUEST=
while read line
do
line=$(echo "$line" | tr -d '[\r\n]')