Skip to content

Instantly share code, notes, and snippets.

@jtanx
jtanx / clang-format.xt
Created March 11, 2019 20:09
Clang format
"C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: LLVM, UseTab: Always, AccessModifierOffset: -4, IndentWidth: 4, CompactNamespaces: true, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: true, ColumnLimit: 0, TabWidth: 4, PointerAlignment: Left, AlignAfterOpenBracket: DontAlign, BreakBeforeBraces: Custom, BraceWrapping: {AfterClass: true, AfterControlStatement: true, AfterEnum: true, AfterFunction: true, AfterNamespace: false, AfterObjCDeclaration: true, AfterStruct: true, AfterUnion: true, BeforeCatch: true, BeforeElse: true, IndentBraces: false}, BreakConstructorInitializers: BeforeComma}",
@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.

@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 / .config
Created December 28, 2018 13:02
A5-V11 config for 'make menuconfig' - NCM, CDC ethernet support, USB ext4 storage support, SQM support, no IPv6, no opkg
#
# Automatically generated file; DO NOT EDIT.
# OpenWrt Configuration
#
CONFIG_MODULES=y
CONFIG_HAVE_DOT_CONFIG=y
# CONFIG_TARGET_sunxi is not set
# CONFIG_TARGET_apm821xx is not set
# CONFIG_TARGET_ath25 is not set
# CONFIG_TARGET_ar71xx is not set
@jtanx
jtanx / hilink-12d1-14db.txt
Created December 28, 2018 12:48
Huawei E8372h lsusb verbose output
@jtanx
jtanx / Hong Kong.txt
Created December 28, 2018 05:18
Flag Drawing V1
path-start
stroke-width 1
stroke #ffffff
fill #ffffff
path m 449.96406,299.9134 c -105.26305,-44.48626 -58.60174,-181.58185 42.06956,-174.6907 -20.36609,10.46694 -23.31775,29.99772 -11.68704,48.09021 13.02444,20.2558 -1.19897,52.84856 -18.80577,60.7674 -28.93485,13.02443 -34.72791,47.74999 -11.57675,65.83309 z
path-end
path-start
stroke-width 1
stroke #de2910
@jtanx
jtanx / index.html
Created November 29, 2018 11:34
bokeh shennanigans
{% extends base %}
{% block preamble %}
<style>
.hidden {
display: none !important;
}
.bk-grid.bk-layout-fixed {
width: auto !important;
height: auto !important;
@jtanx
jtanx / results.md
Last active September 15, 2018 01:44
log slowness

Windows

  • VS2015 x64: 10.19 sec: 3591342062.644168

  • mingw-w64 x64 gcc 7.3.0 (msys2): 29.3 sec: 3591342062.644168

  • VS2015 32-bit: 13.71 sec: 3591342062.644168

  • mingw-w64 32-bit gcc 7.3.0 (msys2): 27.23 sec: 3591342062.644168

  • windows go 1.8.3: 16.67 sec: 3591342062.644168

@jtanx
jtanx / MSYS2 base package creation.md
Last active March 2, 2018 10:13
Creating the MSYS2 base package from scratch

MSYS2 base package

This is one method to create the base package required to bootstrap an msys2 environment. I'm not sure if it's the official way.

Note: You'll have to run this from an existing msys2 installation.

mkdir -p msys64/var/lib/pacman
pacman -r msys64 -Sy base
@jtanx
jtanx / display.py
Last active November 25, 2018 08:22
Simple image viewer
from flask import Flask, redirect, url_for, render_template_string, send_from_directory, make_response, Response
from functools import wraps, update_wrapper
from datetime import datetime
from zipfile import ZipFile
import os
import sys
app = Flask(__name__)
arch = None