Skip to content

Instantly share code, notes, and snippets.


mike qin 1mike12

View GitHub Profile
1mike12 / gist:c44eefcf34ce612e169b8dd45985526a
Created May 21, 2021
Entrepreneurial optimism pessimism double think
View gist:c44eefcf34ce612e169b8dd45985526a
How I built this 32:09 canva
Tfs 343 stripe 1:01:43
1mike12 / arcane windows
Last active Aug 14, 2020
arcane windows commands
View arcane windows

remove all crap from windows Get-AppXPackage | Remove-AppXPackage

get back windows store Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

remove all tiles and crap on start menu

#Requires -RunAsAdministrator

1mike12 / 1 machine learning
Last active Aug 16, 2020
How to get Windows Subsystem Linux 2 and ML working on windows
View 1 machine learning

1 enable WSL

in admin PS dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

2 Get latest windows developer preview.

You need build 19041 or higher (check version with ver in command prompt), which as of now requires a windows 10 preview build. You have to enable them through your microsoft account.

3 Enable WSL 2

1mike12 /
Last active Feb 11, 2019
Step By Step Node Nginx Postgres

Ubuntu shit

add larger swapfile

  1. fallocate -l 1G /swapfile
  2. chmod 600 /swapfile
  3. mkswap /swapfile
  4. swapon /swapfile
  5. echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
  • make swapfile persist through restarts


1mike12 / mocha.js
Last active Feb 14, 2021
Mocha chai expecting exceptions (sync and async)
View mocha.js
//setup async support (doesn't come out of box with chai)
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
expect(()=> syncFunction()).to.throw(ErrorClass, "error message")
await expect(asyncFunction()).rejectedWith(ErrorClass, "error message")
1mike12 / Fast
Last active Aug 9, 2020
fast hotstop tethering
View Fast

on android

adb shell

settings put global tether_dun_required 0

with root permsission and running as SU

# makes the build.prop file editable
mount -o rw,remount /

# adds a line in build.props
1mike12 / testing in
Last active Aug 31, 2018
Describes how to get webstorm/intellij tests working
View testing in

Why the HELL do my tests run as node instead of a test?

Webstorm only runs tests from the right click menu depending on what it finds in package.json

ie. if it finds mocha as a dependency, then it will assume mocha when you attempt to run.

not visually a test

Webstorm looks for the pattern test("...") or describe("...") in the file somewhere, before it will mark a file as a test file

setting up Jest

1mike12 / how to
Last active Apr 13, 2021
node and react git post-receive hook deployment
View how to


  1. make a project/ directory and project.git/ directory
  2. cd project.git && git init --bare
  3. cd project.git/hooks && touch post-receive
  4. copy paste post-receive script
  5. make executable chmod +x post-receive


git remote add production


Saving with relationship

Way to save new model in relation to a pre-existing one. Will automatically handle setting correct foreign keys. many to many

let instance = {
  courses : ()=> this.belongsToMany(require("./course"))
module.exports = Bookshelf.extend(instance)
1mike12 /
Created Dec 14, 2017
SCSS/Sass for ejected create react app because webpack must change every fucking week
'use strict';
const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');