Skip to content

Instantly share code, notes, and snippets.

@jtanx
jtanx / ggtkwindow.c
Created March 24, 2019 03:16
Minimal GTK custom widget implementation
#include "ggtkwindow.h"
// Define the structure of the type
struct _GGtkWindow
{
GtkLayout parent_instance;
// private data here
// because this is a final type, I don't need to use G_DEFINE_TYPE_WITH_PRIVATE
// and jump through all the hoops that entails. That is required
@jtanx
jtanx / gtk.c
Last active March 26, 2019 09:12
messing around with gtk
#include <gtk/gtk.h>
#include <stdbool.h>
typedef struct ggtkwindow *GGTKWindow;
// GGtkWindow GObject declaration
#define GGTK_TYPE_WINDOW ggtk_window_get_type()
G_DECLARE_FINAL_TYPE(GGtkWindow, ggtk_window, GGTK, WINDOW, GtkLayout)
@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 <[email protected]>
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