Skip to content

Instantly share code, notes, and snippets.

View cedric-sun's full-sized avatar

Dusk Traveler cedric-sun

  • Planet Earth
View GitHub Profile
@cedric-sun
cedric-sun / .clang-format
Created August 18, 2022 08:08
clang-format 14 --style=llvm --dump-config
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
@cedric-sun
cedric-sun / archlinux_stock_linux_5.8.10.txt
Created October 9, 2020 15:27
LFS linux 5.8.3 v.s. archlinux stock linux 5.8.10
BYTE UNIX Benchmarks (Version 5.1.3)
System: ARCH3: GNU/Linux
OS: GNU/Linux -- 5.8.10-arch1-1 -- #1 SMP PREEMPT Thu, 17 Sep 2020 18:01:06 +0000
Machine: x86_64 (unknown)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz (5190.1 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
CPU 1: Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz (5190.1 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
@cedric-sun
cedric-sun / Solution.java
Created December 25, 2019 22:22
weird leetcode 28 java NPE
class Solution {
public int strStr(String haystack, String needle) {
if (needle.isEmpty()) return 0;
return new KMPOptimized(haystack,needle).kmp();
}
class KMPOptimized {
String text;
String pattern;
int[] T;
@cedric-sun
cedric-sun / Interpreter_block.java
Last active December 2, 2019 06:59
the handling of a block in the recursive interpreter of a subgrammar of Lua
@Override
public Object visitBlock(Block block, Object arg) throws Exception {
for (int i = 0; i < block.stats.size(); i++) {
Stat stat = block.stats.get(i);
try {
stat.visit(this, arg);
} catch (BreakException e) {
// need to know if break inside a loop
if (stat instanceof StatWhile ||
stat instanceof StatRepeat) {
@cedric-sun
cedric-sun / LeftistHeap.java
Created November 16, 2018 22:13
Leftist heap
public class LeftistHeap<E> {
// could be static class?
class Node {
E data;
Node leftChild, rightChild;
int s = 1;
public Node(E data) {
this.data = data;
}
@cedric-sun
cedric-sun / acinclude.m4
Created December 18, 2017 01:42
bfd/acinclude.m4 snippet
if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
install_libbfd_p=yes
else
install_libbfd_p=no
fi)
@cedric-sun
cedric-sun / gui-config.json
Last active September 26, 2017 13:28
Sample gui-config.json file
{
"configs": [
{
"server": "a.b.c0.net",
"server_port": 52240,
"local_port": 1080,
"password": "12345",
"method": "aes-256-cfb"
},
{
@cedric-sun
cedric-sun / ss-qt5_crash_log_00.crash
Last active September 26, 2017 13:32
ss-qt5 crash log
ProblemType: Crash
Architecture: amd64
CrashCounter: 1
CurrentDesktop: Unity
Date: Tue Sep 26 09:13:39 2017
DistroRelease: Ubuntu 16.04
ExecutablePath: /usr/bin/ss-qt5
ExecutableTimestamp: 1502037653
ProcCmdline: ss-qt5
ProcCwd: /home/cedric