Skip to content

Instantly share code, notes, and snippets.

View nguyentruongtho's full-sized avatar

Tho Neyugn nguyentruongtho

View GitHub Profile
@nguyentruongtho
nguyentruongtho / vim-heroku.sh
Created December 27, 2022 00:18 — forked from dvdbng/vim-heroku.sh
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@nguyentruongtho
nguyentruongtho / captive.md
Created May 25, 2022 14:00 — forked from razhangwei/captive.md
Disable captive network support in #MacOS (useful for wifi connection in public places like Starbucks)

To disable it, set this preference

sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -boolean false

Then, as @Leon mentions, use the regular web browser to login. Or if you are on a network where that somehow does not work then you can still try and open the app manually (located at /System/Library/CoreServices/Captive Network Assistant.app )

In case, you would ever want to remove this setting, you can do:

sudo defaults delete /Library/Preferences/SystemConfiguration/com.apple.captive.control Active
@nguyentruongtho
nguyentruongtho / unfreeze_messages.cpp
Created March 18, 2022 23:19
Prevents the game from freezing when interacting with the title bar.
// reversed from https://gist.github.com/shavitush/0d25bc384b52412f035e959fc71d6ce4
auto __stdcall hooks::CreateWindowExA(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle,
int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) -> HWND
{
auto hWnd = trampolines::CreateWindowExA(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
if(std::strcmp(lpClassName, "MapleStoryClass") == 0)
{
wndproc::original = reinterpret_cast<WNDPROC>(::SetWindowLongA(hWnd, GWLP_WNDPROC, reinterpret_cast<long long>(wndproc::custom_wndproc)));
@nguyentruongtho
nguyentruongtho / script.idc
Created March 12, 2022 19:47 — forked from diamondo25/script.idc
MapleStory IDC script
// IDC script for identifying functions and such
#include <idc.idc>
#define RenameFunction(a, b) Message("Found %s at %a\r\n", b, a); MakeName(a, b)
#define START_ADDR 0x00400000
static main() {
auto addr = BADADDR;
auto onMovePacket = FindAoBAndRename("25 0C FE FF FF 05 E8 03", "?OnMovePacket@CMovePath@@QAEXAAVCInPacket@@H@Z");
@nguyentruongtho
nguyentruongtho / awk_netstat.sh
Created October 8, 2019 21:51 — forked from staaldraad/awk_netstat.sh
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){
@nguyentruongtho
nguyentruongtho / gifify
Created December 5, 2016 15:56 — forked from berikv/gifify
Transform a movie file to a gif. Specialised for demo's of Mobile app screen recordings.
#!/bin/bash
FFMPEG=`which ffmpeg`
INFILE=$1
OUTFILE="${INFILE}.gif"
TMPFILE="${INFILE}_gifify_palette.png"
if ! $FFMPEG -L > /dev/null 2>&1; then
echo "Run: brew install ffmpeg"
exit -1
def reverseProxy = Action.async(parse.raw) {
request: Request[RawBuffer] =>
// Create the request to the upstream server:
val proxyRequest =
WS.url("http://localhost:8887" + request.path)
.withFollowRedirects(false)
.withMethod(request.method)
.withVirtualHost("localhost:9000")
.withHeaders(flattenMultiMap(request.headers.toMap): _*)
.withQueryString(request.queryString.mapValues(_.head).toSeq: _*)
/*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software