Skip to content

Instantly share code, notes, and snippets.

View teddyhartanto's full-sized avatar

Teddy Hartanto teddyhartanto

View GitHub Profile
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
background: repeat url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/7QCIUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGscAVoAAxslRxwCAAACAAAcAnQAV8KpIENoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbGQgLSBodHRwOi8vd3d3LnJlZGJ1YmJsZS5jb20vcGVvcGxlL0NoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAA
@teddyhartanto
teddyhartanto / README-Template.md
Created March 11, 2018 10:26 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008
Compiled by Eric Pement - eric [at] pement.org version 0.27
Latest version of this file (in English) is usually at:
http://www.pement.org/awk/awk1line.txt
This file will also be available in other languages:
Chinese - http://ximix.org/translation/awk1line_zh-CN.txt
USAGE:
@teddyhartanto
teddyhartanto / passwordless_ssh.txt
Last active September 8, 2017 14:21
Passwordless ssh
The underlying technology used here is the public key encryption scheme.
1. Use ssh-keygen, specify the name of the file containing the key
2. Copy the contents of the generated public key to ~/.ssh/authorized_keys in remote host
3. In remote host, chmod 600 authorized_keys
4. Enjoy ssh without passwords!
@teddyhartanto
teddyhartanto / Modifying key mapping.txt
Last active December 25, 2017 09:18
Modifying key mapping in Linux distros
Source: http://askubuntu.com/questions/296155/how-can-i-remap-keyboard-keys
xev
[Press the button you want to change]
[Press the button you want to map to]
quit the program
xmodmap -e "keycode [key_to_change] = [what_you_want] [what_you_want_on_shift]"
xmodmap -pke | grep [keycode]
See the changes take place. Enjoy!
@teddyhartanto
teddyhartanto / build from source.txt
Created February 8, 2017 02:44
Building from source
1. sudo apt-get install build-essential
-> This will fetch all the common packages you need to build anything (e.g. the compiler etc.)
2. sudo apt-get build-dep python2.7
-> This will fetch all the libraries you need to build python.
3. wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar -xf Python-2.7.13.tgz
-> Then download the source code for python and decompress it into a directory.
4. cd Python-2.7.13
5. ./configure
-> this check if you have the essential libraries needed to build the source (i.e. check if you're ready to build)
@teddyhartanto
teddyhartanto / iptables_quick_tutorial.txt
Last active March 30, 2018 10:24
Iptables quick tutorial
First of all, kudos to these great resources:
1. https://www.digitalocean.com/community/tutorials/how-the-iptables-firewall-works
2. https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-iptables-on-ubuntu-14-04
3. https://www.digitalocean.com/community/tutorials/iptables-essentials-common-firewall-rules-and-commands
4. https://help.ubuntu.com/community/IptablesHowTo
5. http://www.howtogeek.com/177621/the-beginners-guide-to-iptables-the-linux-firewall/
Okay, let's get started:
Glossaries:
- Tables = network chain-rules-target-policy are stored in tables. By default, the filter table is used when `-t` is unspecified. However, there are other tables, such as the nat table.
@teddyhartanto
teddyhartanto / bash-cheatsheet.sh
Created October 11, 2016 11:03 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04