Skip to content

Instantly share code, notes, and snippets.

@jtanx
jtanx / 0001-Add-Huawei-alt-mode-support.patch
Created December 28, 2018 13:10
usbmode huawei alt mode patch
From 7b33451b684c5c2703ee8ff9a523c8384337eaa0 Mon Sep 17 00:00:00 2001
From: Jeremy Tan <jtanx@outlook.com>
Date: Thu, 27 Dec 2018 20:28:27 +0800
Subject: [PATCH] Add Huawei alt mode support
diff --git a/convert-modeswitch.pl b/convert-modeswitch.pl
index b1530bd..33f123b 100755
--- a/convert-modeswitch.pl
+++ b/convert-modeswitch.pl
@jtanx
jtanx / keybindings.json
Created April 23, 2017 09:33
Visual Studio Code disable MRU tab switching
[
{
"key": "ctrl+shift+tab",
"command": "workbench.action.previousEditor"
},
{
"key": "ctrl+tab",
"command": "workbench.action.nextEditor"
}
]
@jtanx
jtanx / gist:e98d78381eb731e71ca2
Created July 4, 2015 02:24
List of results from setlocale(LC_ALL, "")
Afrikaans_South Africa.1252
Albanian_Albania.1250
Alsatian_France.1252
Arabic_Algeria.1256
Arabic_Bahrain.1256
Arabic_Egypt.1256
Arabic_Iraq.1256
Arabic_Jordan.1256
Arabic_Kuwait.1256
Arabic_Lebanon.1256
@jtanx
jtanx / CMakeLists.txt
Created July 5, 2022 11:16
Working example of writing a Parquet file in C++
cmake_minimum_required(VERSION 3.10)
project(parq)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
find_package(Arrow REQUIRED)
add_executable(parq park.cc)
@jtanx
jtanx / pad.cmake
Last active May 26, 2022 23:11
Padding a string in cmake
function(pad_string output str padchar length)
string(LENGTH "${str}" _strlen)
math(EXPR _strlen "${length} - ${_strlen}")
if(_strlen GREATER 0)
if(${CMAKE_VERSION} VERSION_LESS "3.14")
unset(_pad)
foreach(_i RANGE 1 ${_strlen}) # inclusive
string(APPEND _pad ${padchar})
endforeach()
@jtanx
jtanx / enctest.c
Created March 21, 2021 10:04
fontforge encoding comparison
#include <stdio.h>
#include <utype.h>
#include <chardata.h>
#include <encoding.h>
static int umodenc(int enc, int modtype)
{
if (modtype == -1)
return (-1);
@jtanx
jtanx / splitbins.py
Created March 21, 2021 09:17
3 vs 4-level lookup tables for unicode data
# Based on the algorithm in https://github.com/python/cpython/blob/master/Tools/unicode/makeunicodedata.py
import math
import sys
def getsize(data):
# return smallest possible integer size for the given array
maxdata = max(data)
if maxdata < 256:
return 1
@jtanx
jtanx / highlighter.ahk
Last active January 2, 2021 18:12
Acrobat DC Highlighter tool
; Set colour Acrobat DC
; Valid x positions: 20, 35, 55, 75, 90, 111, 128, 146
; Valid y positions: 60, 80, 100, 120, 135
SetColour(x, y)
{
If WinExist("Highlighter Tool Properties ahk_class AVL_AVFloating") or WinExist("Highlight Properties ahk_class AVL_AVFloating")
{
WinActivate
WinWaitActive
if !ErrorLevel
@jtanx
jtanx / conns.yml
Created March 9, 2020 10:16
Service discovery descriptor
config:
min_port: 1000
max_port: 2000
shmem:
default:
- proc_a
- proc_b
tcp:
default:
- proc_a
@jtanx
jtanx / README.md
Last active December 28, 2019 08:24
Partial OpenWRT NB604N support

NB604N support

NOTE: Superceded by openwrt/openwrt#2655

The issue on persisting data to flash is resolved by the patches to spi-nor.c in that PR.

Mostly works, but I can't get changes to persist to flash, so settings are lost on reboot. Looking in dmesg there's some jffs2 issues that I can't work out.

Use the brcmsmac driver for wireless support, delete all references to the b43 driver, or you will end up with at best only 802.11g support instead of 802.11n.