Skip to content

Instantly share code, notes, and snippets.

View haxpor's full-sized avatar
🤓
Some of my financial tools https://www.mql5.com/en/users/haxpor/seller

Wasin Thonkaew haxpor

🤓
Some of my financial tools https://www.mql5.com/en/users/haxpor/seller
View GitHub Profile
@haxpor
haxpor / successful-sdl2-manpage_ppa.log
Created November 4, 2021 12:53
Succesful PPA package build for my sdl2-manpage
Copy verbatim from https://launchpadlibrarian.net/567163425/buildlog_ubuntu-focal-amd64.sdl2-manpage_0.1.6-git-aae7035-1_BUILDING.txt.gz
----
https://launchpad.net/~haxpor/+archive/ubuntu/combined/+build/22371425
RUN: /usr/share/launchpad-buildd/bin/builder-prep
Kernel version: Linux lgw01-amd64-026 4.15.0-161-generic #169-Ubuntu SMP Fri Oct 15 13:41:54 UTC 2021 x86_64
Buildd toolchain package versions: launchpad-buildd_203~505~ubuntu18.04.1 python3-lpbuildd_203~505~ubuntu18.04.1 sbuild_0.75.0-1ubuntu1 bzr-builder_0.7.3+bzr174~ppa13~ubuntu16.04.1 bzr_2.7.0+bzr6622-10 git-build-recipe_0.3.6~git201906051340.ff11471~ubuntu18.04.1 git_1:2.17.1-1ubuntu0.9 dpkg-dev_1.19.0.5ubuntu2.3 python-debian_0.1.32 python3-debian_0.1.32.
Syncing the system clock with the buildd NTP service...
4 Nov 12:34:41 ntpdate[1782]: adjust time server 10.211.37.1 offset -0.000445 sec
@haxpor
haxpor / sdl2-manpage_0.1.2.log
Created November 4, 2021 10:52
Log of my failed PPA package sdl2-manpage build that uses 'sudo' inside the rules overridden script
Upstream at https://launchpadlibrarian.net/567143148/buildlog_ubuntu-focal-amd64.sdl2-manpage_0.1.2-git-a1b229a-1_BUILDING.txt.gz
'sudo' is not allowed in PPA packaging script.
Copied verbatim here
----
https://launchpad.net/~haxpor/+archive/ubuntu/combined/+build/22371171
RUN: /usr/share/launchpad-buildd/bin/builder-prep
@haxpor
haxpor / kernel_patch_note.md
Last active November 3, 2021 20:09
Note on linux kernel patch submission

Prepare a patch

  • Set up your email client properly Better to set inside the each local git project's .git/config instead of all-in-one globally at ~/.gitconfig as each project might need different account / credential. Add the following (in this case we use mutt, just take advantage of certificates as used by it for ease of integration)

    [sendemail]
      from = FirstName Lastname <email@domain.com>
      smtpEncryption = tls
    
@haxpor
haxpor / control.tar.xz_dump.log
Created November 2, 2021 13:44
Inspect quilt package (version 0.65-3) for how to create PPA package.
## cat all files after extracting control.tar.xz with the command `find . -type f | xargs -I{} bash -c 'echo {}; cat {}; echo --------------;'`
./control
Package: quilt
Version: 0.65-3
Architecture: all
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Martin Quinson <mquinson@debian.org>
Installed-Size: 785
Depends: bsdmainutils, bzip2, diffstat, gettext, patch, sensible-utils, perl
@haxpor
haxpor / do.sh
Last active September 8, 2021 20:13
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.
#/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 / caveat_getfuncname.vim
Created August 29, 2021 20:17
Implementation to get the current function in the current scope as of cursor position is in (with caveat)
" show the function name for the current position the cursor is in
" cursor needs to be embraced into the context of function
" CAVEAT: not work yet with macros
" CAVEAT: cursor outside of functions but inside a namespace will return upper
" function scope, not the namespace scope
function! ShowFuncNameC_CPP()
let lnum = line(".")
let col = col(".")
let is_found = 0
echohl ModeMsg
@haxpor
haxpor / lightline_WhatFunction.patch
Created August 28, 2021 18:15
patch for vim lightline (at bb0b401) be fix its non-updated col when use vim script to get function name https://vim.fandom.com/wiki/Show_what_function_the_cursor_is_in
diff --git a/autoload/lightline.vim b/autoload/lightline.vim
index 2076a11..6aab48f 100644
--- a/autoload/lightline.vim
+++ b/autoload/lightline.vim
@@ -106,7 +106,7 @@ let s:_lightline = {
\ 'paste': '%{&paste?"PASTE":""}', 'readonly': '%R', 'charvalue': '%b', 'charvaluehex': '%B',
\ 'spell': '%{&spell?&spelllang:""}', 'fileencoding': '%{&fenc!=#""?&fenc:&enc}', 'fileformat': '%{&ff}',
\ 'filetype': '%{&ft!=#""?&ft:"no ft"}', 'percent': '%3p%%', 'percentwin': '%P',
- \ 'lineinfo': '%3l:%-2v', 'line': '%l', 'column': '%c', 'close': '%999X X ', 'winnr': '%{winnr()}'
+ \ 'lineinfo': '%3l:%-2{col(".")}', 'line': '%l', 'column': '%c', 'close': '%999X X ', 'winnr': '%{winnr()}'
@haxpor
haxpor / gist:dd192e03104e67ef9f473c78ec8b2081
Created August 15, 2021 11:41
Result from objdump of linux module which didn't use `module_init()/module_exit()`, and the one that use it.
haxpor@haxpor-desktop:.../Projects/kern_st/hello-1$ objdump -Tt hello-1.ko
hello-1.ko: file format elf64-x86-64
objdump: hello-1.ko: not a dynamic object
SYMBOL TABLE:
0000000000000000 l d .note.gnu.build-id 0000000000000000 .note.gnu.build-id
0000000000000000 l d .note.Linux 0000000000000000 .note.Linux
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l d .text.unlikely 0000000000000000 .text.unlikely
@haxpor
haxpor / hello-1.c
Last active August 14, 2021 19:04
strace for insmod, and rmmod of a simple kernel module. Executed with `sudo strace -v insmod <.ko-file>` and vice-versa.
## insmod
execve("/usr/sbin/insmod", ["insmod", "hello-1.ko"], ["COLORTERM=truecolor", "LC_ADDRESS=en_US.UTF-8", "LC_NAME=en_US.UTF-8", "LC_MONETARY=en_US.UTF-8", "XAUTHORITY=/run/user/1000/gdm/Xa"..., "LC_PAPER=en_US.UTF-8", "LANG=en_US.UTF-8", "LS_COLORS=rs=0:di=01;34:ln=01;36"..., "TERM=screen-256color", "LC_IDENTIFICATION=en_US.UTF-8", "DISPLAY=:0", "LC_TELEPHONE=en_US.UTF-8", "LC_MEASUREMENT=en_US.UTF-8", "LC_TIME=en_US.UTF-8", "PATH=/usr/local/sbin:/usr/local/"..., "LC_NUMERIC=en_US.UTF-8", "MAIL=/var/mail/root", "LOGNAME=root", "USER=root", "HOME=/root", "SHELL=/bin/bash", "SUDO_COMMAND=/usr/bin/strace -v "..., "SUDO_USER=haxpor", "SUDO_UID=1000", "SUDO_GID=1000"]) = 0
brk(NULL) = 0x564213d1c000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffff1ceef80) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_dev=makedev(0x103, 0x2), st_ino=16966, st_mode=
@haxpor
haxpor / attempts.md
Last active August 9, 2021 22:11
Guideline to cross-compile CMake that also includes ccmake for Windows on Ubuntu Linux

There are 3 attempts used

  1. Cross-compile CMake with mingw64 + pre-built mingw64 ncurses - See cmake_crosscompile_mingw64_ncurses.md
  2. Cross-compile both CMake and pdcurses with mingw64 - See cmake_crosscompile_mingw64_pdcurses.md (Recommended)
  3. Natively compile CMake and pdcurses with MSVC - See cmake_native_cmake_pdcurses.md

All above 3 attempts shared the common steps but still listing such shared content in each of its own guide for reference and clear guideline.

Problem