Skip to content

Instantly share code, notes, and snippets.

View newstack-01-file-descriptors.c
ssize_t read(int fd, void *buf, size_t count);
ssize_t write(int fd, const void *buf, size_t count);
NobodyXu /
Created Jan 23, 2020
Run vmware with unity using cygwin/x

Install cygwin/x

See here


Install putty, and then enter your virtual machine's IP, then go to Connection->ssh->X11, click Enable X11 forwarding and give the Xauthority file C:\Cygwin64\C:\cygwin64\home\${YOUR_USERNAME_HERE}\.Xauthority. Save the session with your favorite name to reuse the session.

NobodyXu /
Last active Jan 23, 2020
Run WSL with GUI


First, install cygwin/x. If no mirror are found, google 'cygwin/x mirrors' and you shall find many. Make sure xorg is always installed. Then, open "XWin server" file location from start menu, add -- -listen tcp to the end of target.


  1. tree: Display directory and its child dir (can be controlled via -L level) in tree.
NobodyXu /
Created Nov 6, 2019
generating with seq quickly
seq 1 100000000 | parallel -k --pipe "sed 's/[0-9]*/https:\/\/&/'"
NobodyXu /
Last active Mar 28, 2019
challenges -- A place where I save the solutions to challenges which I think is beautiful
#!/usr/bin/env python3
import sys
# rowList is a list who the first and last element is 0(which will not be printed)
def print_pascal_triangle_row(row):
print(" ".join([str(each) for each in row[1 : -1]]))
# @parm n denotes how many rows should it print
def print_pascal_triangle(n):
NobodyXu /
Last active May 20, 2019
About R
  • Semantics:
    • assignment:
      • When assigning a variable to another name, eg, a = b, a new object is created. However, no data is copied due to the [copy-on-modify][ref1]
    • In order to xor booleans, use xor(a, b).
    • reminder and quotient
      • %% for reminder and %/% for quotient.
    • For accessing list inside list, [[index]] must be used.
    • For returning a vector from a data.frame or data.table, df[[one_list_index]] must be used.
    • slicing:
      • Slicing happens when you [] a container (vector, list, etc) using more than one index, generated by seq or : or c(). The index used can be integers or charaters.
You can’t perform that action at this time.