Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
Working from home

Faizar Septiawan icarrr

🏡
Working from home
View GitHub Profile
@icarrr
icarrr / readme.md
Created Jun 4, 2021
#Python Encode & Decode URL
View readme.md

Python

Encode & Decode URL

Python2

$ alias urldecode='python -c "import sys, urllib as ul; \
    print ul.unquote_plus(sys.argv[1])"'
@icarrr
icarrr / port-forwarding.sh
Created Mar 26, 2021
Forward port from private network to public port
View port-forwarding.sh
#!/bin/bash
# sudo iptables -t nat -I POSTROUTING -m comment --comment "NAT the src ip" -d 192.168.42.12 -o ppp0 -j MASQUERADE
sudo iptables -t nat -I POSTROUTING -m comment --comment "NAT the src ip" -d 192.168.42.12 -j MASQUERADE
sudo iptables -I FORWARD -d 192.168.42.12 -m comment --comment "Accept to forward winbox mikrotik traffic" -m tcp -p tcp --dport 800 -j ACCEPT
sudo iptables -I FORWARD -m comment --comment "Accept to forward winbox mikrotik return traffic" -s 192.168.42.12 -m tcp -p tcp --sport 800 -j ACCEPT
sudo iptables -t nat -I PREROUTING -m tcp -p tcp --dport 1001 -m comment --comment "redirect pkts to virtual machine" -j DNAT --to-destination 192.168.42.12:800
View README.md

Open edX

Install Open edX Using Method Native Installation

Add some variables to your server

echo "export LC_ALL='en_US.UTF-8'" >> ~/.bashrc
echo "export LANG='en_US.UTF-8'" >> ~/.bashrc
echo "export LANGUAGE='en_US.UTF-8'" >> ~/.bashrc
@icarrr
icarrr / remove-all-npm-modules-globally.md
Created Nov 7, 2019
remove all npm modules globally
View remove-all-npm-modules-globally.md
$ npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm
@icarrr
icarrr / mongo-3_2_16.sh
Created Nov 1, 2020
Install MongoDB 3.2
View mongo-3_2_16.sh
#!/bin/bash
# Tested : Ubuntu 16.04
set -e
# Setup
mkdir mongo-pkg
cd mongo-pkg
wget https://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.2/multiverse/binary-amd64/mongodb-{org-mongos,org-server,org-shell,org-tools,org}_3.2.16_amd64.deb
sudo dpkg -i *
@icarrr
icarrr / README.md
Last active Sep 15, 2020
chatwoot installation script
View README.md

Chatwoot installation script

@icarrr
icarrr / README.md
Created Feb 29, 2020
example conf nginx using ssl
View README.md

Note: If you want to use main_y config, you need a directory of snippets.

$ tree snippets
snippets
├── self-signed.conf
├── ssl
│   ├── portal.crt
│   └── portal.key
@icarrr
icarrr / web-servers.md
Created Mar 5, 2020 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@icarrr
icarrr / changepassword.sh.j2
Created Jan 22, 2020 — forked from elleryq/changepassword.sh.j2
Create Django super user in ansible
View changepassword.sh.j2
#!/usr/bin/expect
set timeout -1;
spawn {{django_dir}}/venv/bin/python manage.py changepassword {{admin_user}};
expect {
"Password:" { exp_send "{{admin_pass}}\r" ; exp_continue }
"Password (again):" { exp_send "{{admin_pass}}\r" ; exp_continue }
eof
}
@icarrr
icarrr / get_go.sh
Created Jan 17, 2020 — forked from Zate/get_go.sh
Shell script to download and install latest golang
View get_go.sh
#! /bin/bash
# [get_golang.sh](https://gist.github.com/n8henrie/1043443463a4a511acf98aaa4f8f0f69)
# Download latest Golang release for AMD64
# https://dl.google.com/go/go1.10.linux-amd64.tar.gz
set -euf -o pipefail
# Install pre-reqs
sudo apt-get install python3 git -y
o=$(python3 -c $'import os\nprint(os.get_blocking(0))\nos.set_blocking(0, True)')