Skip to content

Instantly share code, notes, and snippets.

View noru's full-sized avatar
🎮
Working from home

xiuxiuxiu noru

🎮
Working from home
View GitHub Profile
alias d='docker'
alias db='docker build'
alias dr='docker run -itd'
alias da='docker attach'
alias dp='docker ps'
alias g='git'
alias gp='git pull --rebase'
alias gb='git branch'
alias gs='git stash'
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@noru
noru / my_tsconfig.json
Last active January 3, 2019 11:40
my tsconfig.json
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "esnext", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */
"lib": [
"es5",
"es2015",
"dom",
"dom.iterable",
@noru
noru / my_tslint.json
Created January 3, 2019 11:36
my tslint.json
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {
"variable-name": [
true,
"check-format",
"allow-leading-underscore",
@noru
noru / binary_search_insert.js
Last active July 16, 2018 14:03
binary_search_insert
/**
* @param {number[]} nums
* @param {number} target
* @return {number}
*/
var searchInsert = function(nums, target) {
let start = 0
let end = nums.length - 1
if (nums[end] < target) {
{
class BinaryHeap {
constructor() {
this.data = []
}
insert(element) {
this.data.push(element)
@noru
noru / vim-cheat-sheet.md
Created April 11, 2017 13:32 — forked from ummahusla/vim-cheat-sheet.md
Vim Cheat Sheet

Modes

Vim has two modes insertion mode and command mode. The editor begins in command mode, where the cursor movement and text deletion and pasting occur. Insertion mode begins upon entering an insertion or change command. [ESC] returns the editor to command mode (where you can quit, for example by typing :q!). Most commands execute as soon as you type them except for "colon" commands which execute when you press the ruturn key.

Quitting

  • :x Exit, saving changes
  • :q Exit as long as there have been no changes
  • ZZ Exit and save changes if any have been made
  • :q! Exit and ignore any changes

Inserting Text

@noru
noru / Stego.js
Created December 21, 2016 02:49 — forked from artsobolev/Stego.js
var revealJS = function(s) {
var hexAlphabet = Array.apply(null, {
length: 10
}).map(Number.call, Number).concat('abcdef'.split(''));
var codes = [8289, 8204, 8205, 8206, 8207, 8234, 8235, 8236, 8237, 8238, 8298, 8299, 8300, 8301, 8302, 8303];
return s.match(/(.{4})/g).map(function(b) {
return b.split('').map(function(i) {
return hexAlphabet[codes.indexOf(i.charCodeAt())]
})