Skip to content

Instantly share code, notes, and snippets.

View mahasak's full-sized avatar
🐻
PapaBear online !!

Max Pijittum mahasak

🐻
PapaBear online !!
View GitHub Profile
@mahasak
mahasak / TMUX cheatsheet.md
Created January 4, 2024 10:46
TMUX cheatsheet.md

tmux cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mahasak
mahasak / .zshrc-tmux
Last active January 4, 2024 09:04
Reattach to tmux over ssh connection
# inside your .bashrc or .zshrc (on the server side) add:
# start tmux if we ssh into the box
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
tmux attach-session -t $USER || tmux new-session -s $USER
fi
# this will attach to an ongoing tmux session or start a new one
# the session name will be the name of the user ($USER)
@mahasak
mahasak / bhuddha.py
Created October 28, 2021 13:38
Ascii art for programmer
# _oo0oo_
# o8888888o
# 88" . "88
# (| -_- |)
# 0\ = /0
# ___/`---'\___
# .' \| |// '.
# / \||| : |||// \
# / _||||| -:- |||||- \
# | | \\ - /// | |

FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@mahasak
mahasak / hanoi.hs
Last active November 18, 2020 15:32
Tower of Hanoi
hanoi :: Int -> [(Int,Int)]
hanoi n = hanoi' n 1 2 3
hanoi' 0 _ _ _ []
hanoi' n src temp dest = top_to_temp ++ botton_to_dest : top_to_dest
where top_to_temp = hanoi' (n-1) src dest temp
bottom_to_dest = (src, dest)
tops_to_dest = (hanoi' (n-1) temp src dest)
@mahasak
mahasak / Keybase.md
Created October 23, 2020 05:42
Keybase.md

Keybase proof

I hereby claim:

  • I am mahasak on github.
  • I am mahasak (https://keybase.io/mahasak) on keybase.
  • I have a public key ASAkVvops8DrRCKonDvu-FSdEGRNTmBgukB8CCFnehK5BQo

To claim this, I am signing this object:

@mahasak
mahasak / gist:82dc17faf73863832bf91c1589424931
Created June 20, 2020 09:15
reload db postgres script
#!/bin/bash
if [[ ! -n $REIMPORTDB_PATH ]]; then
export REIMPORTDB_PATH=/usr/local/bin/
fi
${REIMPORTDB_PATH}dropdb --if-exists {DB_NAME}
${REIMPORTDB_PATH}createdb -U{DB_USER} -O{DB_USER} {DB_NAME}
${REIMPORTDB_PATH}psql -U{DB_USER} {DB_NAME} < database/schema_postgres.sql
fetch("https://api-customer.thaichana.com/shop/search", {
"headers": {
"accept": "application/json, text/plain, */*",
"accept-language": "en-US,en;q=0.9,th;q=0.8,fr;q=0.7",
"content-type": "application/json;charset=UTF-8",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site"
},
"referrer": "https://merchant.thaichana.com/search?size=10&page=0&category=%E0%B8%97%E0%B8%B8%E0%B8%81%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B9%80%E0%B8%A0%E0%B8%97&province=%E0%B8%81%E0%B8%A3%E0%B8%B8%E0%B8%87%E0%B9%80%E0%B8%97%E0%B8%9E%E0%B8%A1%E0%B8%AB%E0%B8%B2%E0%B8%99%E0%B8%84%E0%B8%A3&rating=0&passQuestionnaire=false&lockLatLong=false",
@mahasak
mahasak / IO_Netgarage_Level11.md
Created October 2, 2019 09:51 — forked from jaybosamiya/ IO_Netgarage_Level11.md
IO Netgarage Level11 Solution

IO Netgarage Level 11

Whoo! This was a fun challenge with loads to learn. :)

Understanding the given code

The given code level11.c checks whether the two inputs (as argv[1] and argv[2]) both MD5 hash to the same value or not. If they do, it uses both inputs as brainfuck code, and executes them. Then it checks if the outputs differ. Upon differing outputs, they are checked against the strings "io.sts Rules!" and "io.sts Sucks!". If prog1's output is the first, and prog2's output is the second, we are granted shell.

Understanding the vulnerability

@mahasak
mahasak / Dockerfile
Created July 11, 2019 12:20
Docker JDK 1.4
FROM centos:5
RUN yum -y install ld-linux.so.2
ADD ./j2sdk-1_4_2_19-linux-i586-rpm.bin /
RUN chmod +x /j2sdk-1_4_2_19-linux-i586-rpm.bin
RUN (echo yes) | sh /j2sdk-1_4_2_19-linux-i586-rpm.bin
RUN rpm -Uvh /j2sdk-1_4_2_19-linux-i586.rpm
ENV JAVA_HOME /usr/java/j2sdk1.4.2_19