Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Wasin Thonkaew haxpor

🎯
Focusing
View GitHub Profile
@haxpor
haxpor / listchars_in_vimrc.txt
Created Mar 25, 2021
My listchars configuration in .vimrc file
View listchars_in_vimrc.txt
set listchars=eol:↓,space:·,trail:●,tab:→⇥⇥,extends:>,precedes:<
@haxpor
haxpor / .tmux.conf
Created Feb 20, 2021
My ~/.tmux.conf
View .tmux.conf
# change prefix key to alt+a
set-option -g prefix M-a
# shorten the key repeat interval
set-option -g repeat-time 200
# to not lose the color when enter into tmux
set -g default-terminal "screen-256color"
# bind switching to panel with vim's motion keys
@haxpor
haxpor / open_or_split.sh
Last active Jun 25, 2021
Work with terminal application to open target file via vim
View open_or_split.sh
#!/bin/bash
# From https://pastebin.com/XSuXNJZs by StingyKarmaWhore and u/yramagicman (upstream https://www.reddit.com/r/godot/comments/b7ad4u/open_terminalvim_from_godot/eqtavz1/)
# Modifed by haxpor: auto read from external changes, getting rid of line, and properly target an existing file on server
[ -n "$1" ] && server=$1
[ -n "$2" ] && file=$2
serverlist=`echo $(vim --serverlist)`
echo ${serverlist,,}
if [[ ${serverlist,,} == *"${server,,}"* ]]; then
vim +'set autoread|au CursorHold * checktime' --servername $server --remote-tab-silent $file
@haxpor
haxpor / header_deps.txt
Created May 24, 2020
List of unique include headers (pls excuse ^M line) for kbengine (https://github.com/kbengine/kbengine)
View header_deps.txt
#include <string.h>
#include "${header}"
#include "../../../server/baseapp/baseapp_interface.h"
#include "../../../server/baseapp/baseapp_interface.h"
#include "../../../server/baseappmgr/baseappmgr_interface.h"
#include "../../../server/cellapp/cellapp_interface.h"
#include "../../../server/cellapp/cellapp_interface.h"
#include "../../../server/cellappmgr/cellappmgr_interface.h"
#include "../../../server/dbmgr/dbmgr_interface.h"
@haxpor
haxpor / do.sh
Last active Sep 8, 2021
Script modified on top from tuxutku to bypass automaticaly download, and commented out copying into root to opt-in do it by ourselves. This script is as part of install OpenCL 2.1 driver for AMD GPU on Linux.
View do.sh
#/bin/bash
## Original by tuxutku (https://gist.github.com/tuxutku/79daa2edca131c1525a136b650cdbe0a)
## Modified by haxpor (https://gist.github.com/haxpor/8533fde401853615f4b2e4510048a319)
prefix='amdgpu-pro-'
postfix='-ubuntu-18.04'
major='19.50'
minor='967956'
shared="opt/amdgpu-pro/lib/x86_64-linux-gnu"
srcdir="$(pwd)"
pkgdir="${srcdir}/pkgdir"
@haxpor
haxpor / patch
Created Apr 6, 2020
Patch including FPS computation logic on top of source code so far at https://vulkan-tutorial.com/Drawing_a_triangle/Drawing/Rendering_and_presentation (grab its source looking at the bottom of C++ link). Apply patch via `patch main.cpp < patch`
View patch
--- main-ref.cpp 2020-04-06 15:22:30.210006554 +0700
+++ main2.cpp 2020-04-06 15:23:11.217588339 +0700
@@ -13,11 +13,13 @@
#include <cstdint>
#include <optional>
#include <set>
+#include <iomanip>
const int WIDTH = 800;
const int HEIGHT = 600;
@haxpor
haxpor / singleline-list.txt
Created Apr 2, 2020
Full list in a single line of packages to be installed for AMDGPU-PRO driver for Linux via command `./amdgpu-pro-install --pro --opencl=legacy,pal`
View singleline-list.txt
amdgpu amdgpu-core amdgpu-dkms amdgpu-lib amdgpu-lib32 amdgpu-pro amdgpu-pro-core amdgpu-pro-lib32 clinfo-amdgpu-pro glamor-amdgpu gst-omx-amdgpu libdrm-amdgpu-amdgpu1 libdrm-amdgpu-amdgpu1:i386 libdrm-amdgpu-common libdrm2-amdgpu libdrm2-amdgpu:i386 libegl1-amdgpu-mesa libegl1-amdgpu-mesa:i386 libegl1-amdgpu-mesa-drivers libegl1-amdgpu-mesa-drivers:i386 libegl1-amdgpu-pro libegl1-amdgpu-pro:i386 libgbm1-amdgpu libgbm1-amdgpu:i386 libgl1-amdgpu-mesa-dri libgl1-amdgpu-mesa-dri:i386 libgl1-amdgpu-mesa-glx libgl1-amdgpu-mesa-glx:i386 libgl1-amdgpu-pro-appprofiles libgl1-amdgpu-pro-dri libgl1-amdgpu-pro-dri:i386 libgl1-amdgpu-pro-ext libgl1-amdgpu-pro-glx libgl1-amdgpu-pro-glx:i386 libglapi-amdgpu-mesa libglapi-amdgpu-mesa:i386 libglapi1-amdgpu-pro libglapi1-amdgpu-pro:i386 libgles1-amdgpu-mesa libgles1-amdgpu-mesa:i386 libgles2-amdgpu-mesa libgles2-amdgpu-mesa:i386 libgles2-amdgpu-pro libgles2-amdgpu-pro:i386 libllvm9.0-amdgpu libllvm9.0-amdgpu:i386 libomxil-bellagio-bin libomxil-bellagio0 libopencl1-amdgpu-pro
@haxpor
haxpor / aligned_allocator.cpp
Created Sep 27, 2019 — forked from donny-dont/aligned_allocator.cpp
An aligned allocator for placing SIMD types in std::vector
View aligned_allocator.cpp
#ifdef _WIN32
#include <malloc.h>
#endif
#include <cstdint>
#include <vector>
#include <iostream>
/**
* Allocator for aligned data.
@haxpor
haxpor / gen100.cpp
Last active Sep 16, 2019
Simple program to generate N random numbers into standard output. You can pipe output from program into file manually. Example: echo 50 | ./a.out > random.txt
View gen100.cpp
/**
* Input: n - number of random numbers to generate
* Output: n random numbers printed onto standard output separated by a space.
*/
#include <iostream>
#include <cstdlib>
#include <ctime>
int main()
@haxpor
haxpor / genprogress.cpp
Created Sep 14, 2019
Generation of progress for UVa problem set. Use input.txt as input executing genprogress.cpp program. You can pipe the output to an actual .md file later.
View genprogress.cpp
/**
* Generation of UVa's progress in markdown file.
*
* Input:
* A problem set number separated by a new line, each set will contains 100 problems with number running
* from it to a hundred. Terminate with 0 at the last line.
*
* 1
* 19
* 201