Skip to content

Instantly share code, notes, and snippets.

View xiamx's full-sized avatar
😻
v.v

Meng Xuan Xia xiamx

😻
v.v
View GitHub Profile
@xiamx
xiamx / git-cleanup
Created June 9, 2021 18:57 — forked from larowlan/git-cleanup
Clean up old git branches
#!/bin/bash
# This has to be run from main
git checkout main
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
git branch --merged main | grep -v 'main$' | xargs git branch -d
@xiamx
xiamx / assembler.py
Created April 17, 2019 16:30
XYT CPU assembler
import fileinput
import collections
line_number = 0
instructions = []
labels = {}
opcodes = {"ADD": "0000", "INP": "0100", "PRINT": "0101", "STOP": "0110",
"LW": "1100", "SW": "1101", "BZ":"1001", ".word": ""}
registers = {"$t0": "0", "$t1": "1"}
post_address_set = collections.defaultdict(list)
@xiamx
xiamx / server.py
Last active March 6, 2019 21:58
python grpc server with aggressive keepalive settings
server = grpc.server(
 futures.ThreadPoolExecutor(max_workers=10),
 options=(
('grpc.keepalive_time_ms', 10000),
('grpc.keepalive_timeout_ms', 5000),
('grpc.keepalive_permit_without_calls', True),
('grpc.http2.max_pings_without_data', 0),
('grpc.http2.min_time_between_pings_ms', 10000),
('grpc.http2.min_ping_interval_without_data_ms', 5000),
 )
### Keybase proof
I hereby claim:
* I am xiamx on github.
* I am xiamx (https://keybase.io/xiamx) on keybase.
* I have a public key whose fingerprint is B166 3264 BF6A CB3F 3231 2585 D3A1 BDB2 C2D9 31EB
To claim this, I am signing this object:
@xiamx
xiamx / Makefile
Created February 13, 2013 02:11
Makefile for COMP 206 assignment 2 with -lm option
CC=gcc
CC_FLAGS=-g -O2 -c
OBJECTS=q1.o q2.o q3.o q4.o q5.o
all:$(OBJECTS)
$(CC) q1.o -lm -o q1
$(CC) q2.o -lm -o q2
$(CC) q3.o -lm -o q3
$(CC) q4.o -lm -o q4
$(CC) q5.o -lm -o q5
@xiamx
xiamx / PowerfullTester.java
Created September 25, 2012 00:39
PowerfullTester
package a1posted;
import java.math.BigInteger;
import java.util.LinkedList;
import java.util.Random;
import java.util.Arrays;
//import java.lang.Character;
public class PowerfullTester {
public static void testCase(int[] first,
@xiamx
xiamx / gist:3763954
Created September 21, 2012 21:17
NaturalNumber Tester non-base-10 base
package a1posted;
import java.math.BigInteger;
public class Tester {
public static void main(String[] args) throws Exception {
/* For the sake of readability, we define number coefficients for
this Tester file to be in the usual human readable order:
@xiamx
xiamx / 128505.user.js
Created June 9, 2012 22:38
Turbo Tweak
// ==UserScript==
// @name LoU Tweak Turbo
// @description Adds incredible functionalities to Lord of Ultima, by turbo-charging LoU Tweak v1.6.0
// @namespace SachinM
// @include http://prodgame*.lordofultima.com/*/index.aspx*
// @version 0.3.7
// @require http://sizzlemctwizzle.com/updater.php?id=80532&days=1
// ==/UserScript==
/*
@xiamx
xiamx / 001 - test post
Created April 6, 2011 16:42 — forked from EnigmaCurry/001 - test post
Blogofile template including title meta keywords and meta description
---
categories: General Stuff
date: 201/04/06 15:25:00
title: Just a test
keywords: test, another test, more "tests"
---
Some text here