Skip to content

Instantly share code, notes, and snippets.

View raptium's full-sized avatar
😜

Hao Guan raptium

😜
View GitHub Profile
@raptium
raptium / config.yml
Created September 18, 2021 02:29
k3os config
#cloud-config
ssh_authorized_keys:
- github:raptium
boot_cmd:
- "echo Asia/Shanghai > /etc/timezone"
- "ln -vs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime"
ntp:
pools:
- cn.pool.ntp.org
enabled: true
@raptium
raptium / DebugAdvice.java
Created May 29, 2020 02:11
How to replace input arguments using ByteBuddy's @Advice.AllArguments?
import static net.bytebuddy.matcher.ElementMatchers.is;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.agent.builder.ResettableClassFileTransformer;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.asm.AsmVisitorWrapper;
import net.bytebuddy.implementation.bytecode.assign.Assigner;
import net.bytebuddy.matcher.ElementMatchers;

Keybase proof

I hereby claim:

  • I am raptium on github.
  • I am raptium (https://keybase.io/raptium) on keybase.
  • I have a public key ASDH_funIqiEh54SHbsDfgzEsUIhBuUrLVkseHVKyNTe2Ao

To claim this, I am signing this object:

"""
Copyright 2016 Guan Hao
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@raptium
raptium / private.xml
Created February 16, 2016 06:45
Minila Air HHKB
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>BROADCOM_BLUETOOTH</vendorname>
<vendorid>0x0a5c</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>FILCO_MINILA_AIR</productname>
<productid>0x8502</productid>
</deviceproductdef>
@raptium
raptium / gist:4249602
Created December 10, 2012 09:35
open in new for elearn cuhk
var a=window.frames['content'].document.getElementsByTagName("a");for(var i=0;i<a.length;i++){var e=a[i];var url=e.getAttribute('href');if(url.match(/^\/webapps\/blackboard\/execute\/content\/file/)){url+='&launch_in_new=true';e.setAttribute('href',url)}}
@raptium
raptium / soliton_decrypt.go
Created November 28, 2012 15:49
SOLITON Stupid DRM
package main
import (
"crypto/rc4"
"encoding/base64"
"fmt"
"io"
"log"
"os"
"path/filepath"
@raptium
raptium / gist:4058738
Created November 12, 2012 11:11
IEMS5720 Blogosphere
from apiclient.discovery import build
import httplib2
import json
API_KEY = '...'
vertices = {}
edges = []
def update_user(user):
@raptium
raptium / gist:3754981
Created September 20, 2012 09:48
string
int s(char *str, int len) {
int i, j;
int sum = 0;
int *count = (int *)malloc(sizeof(int) * len);
char *k = (char *)malloc(sizeof(char) * len);
memset(count, 0, sizeof(int) * len);
memset(k, 1, sizeof(char) * len);
for(i = 0;i < len;i++) {
char ch = str[i];
for(j = 0;j <= i;j++) {
@raptium
raptium / split_updata.pl
Created September 19, 2012 10:56
UPDATE.APP unpacker for Huawei G330D
#!/usr/bin/perl
######################################################################
#
# File : split_updata.pl
# Author(s) : McSpoon
# Description : Unpack a Huawei U8220 'UPDATA.APP' file.
# http://pulse.modaco.com
#
# Last Modified : Thu 24 December 2009
# By : McSpoon