Skip to content

Instantly share code, notes, and snippets.

Shichao An shichao-an

Block or report user

Report or block shichao-an

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
shichao-an / gist:8992bd6e03582dc474f5d86b6b2aa440
Last active Mar 29, 2019 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
View gist:8992bd6e03582dc474f5d86b6b2aa440
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
shichao-an / tmpdownloads.plist
Created Apr 24, 2018
Create a Downloads directory on macOS startup/login
View tmpdownloads.plist
<plist version="1.0">
shichao-an /
Last active Mar 10, 2017
English Vocabulary Digest Note 3
  • cringe (vi.) 畏缩; 感到难堪
  • antics (n.) 滑稽的举止
  • nuts and bolts (n.) 基础部分; (adj.) 有关具体细节的
  • innuendo (n.) 暗示; 影射
  • demoralize (vt.) 使泄气
  • endearment (n.) 爱慕
  • outnumber (vt.) 在数量上超过
  • drool (vi.) 淌口水; 垂涎
  • chastise (vt.) 责备
  • whine (vt.) 哭喊
View typeof.c
#include <stdio.h>
#include <stdlib.h>
#define test(x) ({ \
typeof(x) _x = (x); \
_x += 1; \
_x; \
int main(int argc, char* argv[])
View bit_field.c
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char * argv[])
bool a: 1;
bool b: 1;
shichao-an / flexible_array_member.c
Last active Apr 15, 2016
Flexible array member
View flexible_array_member.c
#include <stdio.h>
#include <stdlib.h>
typedef struct string
int length;
char chars[];
} string;
int main(int argc, char * argv[])
shichao-an / struct_offset.c
Created Apr 15, 2016
Get offsets of struct members using offsetof
View struct_offset.c
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct
int x;
short y[3];
long long z;
} data_t;
shichao-an / array-params.c
Created Mar 2, 2016
Arrays as function parameters in C
View array-params.c
#include <stdio.h>
#include <stdlib.h>
/* the array name by default is a pointer to its first element,
* similar to test2
void test1(int len, int x[])
int i;
for (i = 0; i < len; i++)
#!/usr/bin/env bash
# Check if SBC is stable and send a notification
shichao-an /
Last active Jun 5, 2016
English Vocabulary Digest Note 2
  • noob (n.) 新手 (a person who is inexperienced in a particular sphere or activity, especially computing or the use of the Internet.)
  • calamitous (adj.) 灾难性的
  • swamp (vt.) 淹没; 使…应接不暇; 使…人满为患
  • layman/layperson (n.) (non-expert) 外行
  • necessitate (vt.) 使成为必要
  • warrant (vt.) 证明…正当 (justify); 使成为必要 (necessitate); 为...作担保
  • instrumental (adj.) to be instrumental in [something]/doing [something] 对某事物/对做某事起重要作用 (to have important role)
  • stagnant (adj.) (sluggish) 停滞的; 不景气的
  • reap (vt.) 获得
  • weigh (vt.) 权衡; 衡量 (vt.) 有影响 (have influence) (exp. to weigh heavily/very little with [somebody] 对某人影响很大/很小)
You can’t perform that action at this time.