Skip to content

Instantly share code, notes, and snippets.

View junzhengca's full-sized avatar
🥼
ummm.... weird....

Jun junzhengca

🥼
ummm.... weird....
View GitHub Profile
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGBvHVsBEACzyh4GXvmKWU7C9cadJi3hBtVisH61rjOCueSGY6ZBK+pi+HNu
yhVIC0dWwsxZoxES5EvvFJGbBuJbh4SnfXRJhtDtlrWpjDg1/xImUoocdugau9+I
UaK59WcxPjFmEHcQLzz8VFe4txJwN6ZGcjket2+YPxioTOOhZCsLRpyR6jr9nLi0
lT/DiLDlZEKyoXscXOm/4Qn6Sd0nL/XE+UEaTHOQTKbC/87KqVWgLe0dlNPJcpVH
28Iqhm6/2SeTiAKLuzl+kiIck2i+ANCusn018RHOyLq7aKcKCSlKUdbZQVaSSC6d
q3D2WDgd+DVbstVBXp5Frp0F1J+mNzvEc4TV7cLSDpo7izT2k+colAv9uU/bC8mh
io2K1DfQbl0cPUK1uqLpRkaMnNQnOMQeHBx+VdyfBDi6heawVmcX1g+MDjCvqt7z
JAlAN6ujl4CtoMpq/AkNcvQuzcTwtS2UmHebJT/WserfJTPdnxWvVLXcElzBrn7H
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
*, *::before, *::after {
box-sizing: border-box;
}
@junzhengca
junzhengca / 0README.md
Created October 25, 2019 15:22
[Node.js Web Service Stack] Nice stack to setup a Node.js web service.
npm install chalk dotenv inversify reflect-metadata mongoose typescript express body-parser @hapi/boom localized-strings --save
npm install @types/boom @types/chalk  @types/dotenv @types/express @types/node nodemon ts-node --save-dev

And use the following command to start the server

nodemon --watch 'src/**/*.ts' --exec ts-node -- ./src
@junzhengca
junzhengca / cloc.sh
Created October 16, 2019 02:08
[Useful Git Commands] #git
# Count lines of code excluding all json files (useful for excluding package-lock.json)
git ls-files | grep -v ".json" | xargs wc -l
@junzhengca
junzhengca / curl.sh
Last active July 12, 2020 22:11
[Useful Commands] #curl #bash
curl -o /dev/null -s -w 'Establish Connection: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n' https://www.google.com
@junzhengca
junzhengca / introspection.gql
Created September 20, 2019 20:15
[GraphQL Full Introspection Query] #gql
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
// @flow
/*-------------------------------------
* Controller for Admin course page
*
* Author(s): Jun Zheng (me at jackzh dot com)
--------------------------------------*/
const Container = require('../../../Models/Container');
const User = require('../../../Models/User');
const getRealUrl = require('../../../Util/getRealUrl');
class Vector {
constructor(public x: number, public y: number, public z: number) { }
static times(k: number, v: Vector) {
return new Vector(k * v.x, k * v.y, k * v.z);
}
static minus(v1: Vector, v2: Vector) {
return new Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
{
"name": "ifcat.csca48f18",
"assertion_endpoint": "https://my.com"
}
@junzhengca
junzhengca / 0README.md
Last active October 28, 2018 18:14
Cool automation scripts I made and use.

All scripts are tested on macOS, they are not gurenteed to work on Linux.

  • mhosts - Simple script to add and remove hosts from /etc/hosts file.