Skip to content

Instantly share code, notes, and snippets.


Roger Qiu CMCDragonkai

Block or report user

Report or block CMCDragonkai

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
CMCDragonkai /
Last active Oct 14, 2019
Linux Kernel Modules for NixOS #linux #nixos

Linux Kernel Modules for NixOS

You can find what kernel modules are loaded using lsmod.

However some kernel modules are required at stage 1 boot. Basically preloaded in the initial ram disk before switching to the root filesystem. These kernel modules are mostly needed to deal with peripherals, storage devices, filesystems and network devices. You may need to be wary of these required modules:

  • sd_mod - SCSI, SATA, and PATA (IDE) devices
CMCDragonkai / react_lifecycle_hooks.js
Created Aug 26, 2019
React Lifecycle Hooks #js #react
View react_lifecycle_hooks.js
// all react lifecycle stages can be hooked into using the `useEffect` hooks
// acquired from here:
useEffect( () => console.log("mount"), [] );
useEffect( () => console.log("will update data1"), [ data1 ] );
useEffect( () => console.log("will update any") );
useEffect( () => () => console.log("will update data1 or unmount"), [ data1 ] );
useEffect( () => () => console.log("unmount"), [] );
CMCDragonkai /
Last active Aug 22, 2019
Dump Dask Dataframe to Single CSV #python #dask
import os
import tempfile
import shutil
import pandas as pd
import dask.dataframe as df
from pathlib import Path
output_path = Path('tmp')
results = {
CMCDragonkai /
Created Aug 6, 2019
Map Reduce with Dask Dataframes #dask
import functools
import dask
import dask.dataframe as dd
import pandas as pd
pdf = pd.DataFrame({
'x': range(0, 100),
'y': range(0, 100),
'z': range(0, 100)

GoPro on Linux (NixOS)

The GoPro Hero 7 uses MTP for transferring files. To connect on NixOS you need to have MTP.

The best GUI tool for MTP is gmtp. Connect your GoPro and use gmtp to transfer files.

For more advanced interaction with GoPro devices, see

CMCDragonkai / random_range.js
Created Jul 19, 2019
Random Ranges in JS #javascript
View random_range.js
// by scaling the uniform distribution between [0,1) to [min,max)
function randomRangeInt (min, max) {
return min + Math.floor(Math.random() * (max - min));
CMCDragonkai /
Last active Aug 20, 2019
Ideas in HTTP Restful API #http

Ideas in HTTP Restful API


Pagination should always be using 2 parameters: seek and limit.

The seek is the offset into the collection.

The limit is how many to items to acquire.

CMCDragonkai / check_types.js
Created Jun 18, 2019
Checking Types in JavaScript #javascript
View check_types.js
// you often want to check if a value is truthy
function booleanise(v) {
return !!v;
booleanise(0) // false
booleanise('') // false (empty strings is falsey)
booleanise(false) // false
booleanise(null) // false
booleanise(undefined) // false
CMCDragonkai /
Last active Jun 22, 2019
Journey into Nix Package Repository #nix

Journey into Nix Package Repository

There are 2 commits that I need in my build:

  • 8d0e3ad603dda85462161bba1351893b84339462
  • 83e01aa5e48a9107f3b988c9d4c1c21d610626fb

Clone nixpkgs and add the nixpkgs-channels as a remote.

You can’t perform that action at this time.