Skip to content

Instantly share code, notes, and snippets.

View ShikChen's full-sized avatar
💤
Sleeping from home

ShikChen

💤
Sleeping from home
View GitHub Profile
{
"masterRank": 0,
"recentRankedMatches": [
{
"time": "2022-02-06T03:45:32+08:00",
"result": "WIN",
"allyScore": 775,
"opponentScore": 300,
"teamAlly": [
{
@ShikChen
ShikChen / README.md
Last active June 27, 2021 16:22
PTT WebSocket CLI Command

Install https://github.com/vi/websocat to setup a local proxy between wss://ws.ptt.cc/bbs and 127.0.0.1:1337:

$ websocat --oneshot --binary --origin=https://term.ptt.cc tcp-l:127.0.0.1:1337 wss://ws.ptt.cc/bbs

Now use telnet localhost 1337 to connect to PTT. Sadly it will show things with a specialized Big5 + UAO (Unicode 補完計畫), which is not compatible with most of the terminals.

To solve this, either

  1. Enter username with comma like username,, then PTT will show characters in UTF8 after the login screen.
const sleep = (sec) => new Promise(resolve => setTimeout(resolve, sec * 1000))
async function foo() {
console.log(1)
await sleep(1)
console.log(2)
}
(async () => {
foo().then(() => console.log(3))
struct SAM {
struct nd { int l, p; array<int, 26> e; };
vector<nd> v;
SAM() : v(2, nd{0, 0, {0}}) {}
void push(int c) {
int wh = v.size(), st = wh - 1, it = st;
while (it && !v[it].e[c]) it = v[it].p;
if (it && v[v[it].e[c]].l != v[it].l + 1) {
int cp = wh++, ob = v[it].e[c];
v.push_back(nd{v[it].l + 1, v[ob].p, v[ob].e});
@ShikChen
ShikChen / a.txt
Last active November 11, 2017 10:59
echo -e \\x7f\\x45\\x4c\\x46\\x01\\x01\\x01\\x00 >> getflag
echo -e \\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00 >> getflag
echo -e \\x02\\x00\\x08\\x00\\x01\\x00\\x00\\x00 >> getflag
echo -e \\x50\\x08\\x40\\x00\\x34\\x00\\x00\\x00 >> getflag
echo -e \\x00\\x00\\x00\\x00\\x05\\x10\\x00\\x50 >> getflag
echo -e \\x34\\x00\\x20\\x00\\x08\\x00\\x00\\x00 >> getflag
echo -e \\x00\\x00\\x00\\x00\\x06\\x00\\x00\\x00 >> getflag
echo -e \\x34\\x00\\x00\\x00\\x34\\x00\\x40\\x00 >> getflag
echo -e \\x34\\x00\\x40\\x00\\x00\\x01\\x00\\x00 >> getflag
echo -e \\x00\\x01\\x00\\x00\\x05\\x00\\x00\\x00 >> getflag
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 100 columns, instead of 38 in line 1.
131544,26225,5733,84263,79443,65055,23461,23328,23120,8492,7049,79983,3295,3400,2013,23077,4820,7001,948,9759,627,5275,9314,6095,28958,2941,4091,3131,79961,51439,54873,3849,26084,2058,23041,83989,49855,55268,10048,5894,8648,64795,79048,4853,1149,57110,54812,26355,23300,64218,54762,64400,10793,84869,1657,416,51350,3983,54682,2055,4799,10529,51741,84909,51111,400961,79646,22878,55061,9577,2051,8850,210,10181,80349,7175,9374,57496,84302,80339,478,1622,55193,1749,10874,5019,2029,9939,50487,8490,4780,8452,65009,23122,9452,55,10579,23086,1559,5325
2182,1366,3732,3664,1611,27230,6659,2591,5349,230,3783,10159,25978,202,7494,9208,3934,7022,55907,7421,7163,26298,6692,54463,9516,1829,51188,1534,23286,3398,523,10682,80148,4925,51599,22936,64083,1365
89795,5371,55332,28232,27071,1839,23764,3664,6648,9021,54541,10847,80223,51389,4792,3696,2921,10725,9308,9709,10318,56300,10379,7130,1906,3600,196743,3976,2113,5467,127544,8878,29933,5606,79745,375449,80117,9076,2919,6698,27076,3854,4814,4791,8795,3096,8743,57162,5329,10049,2
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
const long long MEM_FORMAT_THRESHOLD = 8LL << 30;
#if defined(__APPLE__) && defined(__MACH__)
#include <mach/mach.h>
00a7b38c8540c6d9711c94a80f032d11 Black
0a8259d7ca3124cb0c4dc24efed2040f Black
0ba4cf98e6b34c0337624c446b94da58 Black
0d01eb95336c9ff85532f39a9818710a Black
0e0da9cd670357848d40a2c2fa1277af Black
0e6747e054a11cc6a2a180e21717a667 Black
0fac4e3e6e32115c6f35edaf2326cb26 Black
1a1b9355d28150a59658e74bdfb0d809 Black
1d3fb5a840058b3215be1cd0afe3d211 Black
1e7d4fa2f730eee80e59e359fd80af1f Black
#include <stdlib.h>
#include <openssl/bn.h>
#include <openssl/rsa.h>
#include <openssl/engine.h>
#include <openssl/pem.h>
const int L = 4 << 20;
char sp[L], sq[L];
int main (int argc, char *argv[])
@ShikChen
ShikChen / reg_ex.py
Created April 20, 2015 08:46
PlaidCTF 2015 REG EX
import itertools
import re
import z3
base = 'plaidctf'
r = open('regex_57f2cf49f6a354b4e8896c57a4e3c973.txt').read().strip()
s = re.search(r'\((.*)\)', r).group(1)
s = s.split('|')[3:]
s = [re.findall(r'(.*?)\[(.*?)\]', it) for it in s]