Skip to content

Instantly share code, notes, and snippets.


mparaiso Mparaiso

View GitHub Profile
Mparaiso /
Last active Oct 17, 2018
SQL to mongodb command cheat sheet: How to translate SQL into mongodb command?

SQL to Mongodb How to translate SQL into a Mongodb command?

SQL Mongodb
INSERT INTO collection(username,email,age) VALUES('johndoe','',28) db.collection.insert({username:'johndoe',''})
UPDATE collection SET username = 'jackdoe' WHERE email = ''' db.collection.update({email:'''},{$set{username:'jackdoe'}})
SELECT COUNT(*) as count FROM collection WHERE age >= 18 db.collection.count({age:{$gte:18}}) or db.collection.aggregate([{$match:{age:{$gte:18}}},{$count:"count"}])
Mparaiso / .tmux.conf
Created Apr 15, 2017 — forked from paulodeleo/.tmux.conf
Tmux configuration to enable mouse scroll and mouse panel select, taken from:
View .tmux.conf
# Make mouse useful in copy mode
setw -g mode-mouse on
# Allow mouse to select which pane to use
set -g mouse-select-pane on
# Allow mouse dragging to resize panes
set -g mouse-resize-pane on
# Allow mouse to select windows
Mparaiso / postsql.sql
Created Apr 12, 2017 — forked from tobyhede/postsql.sql
PostgreSQL as JSON Document Store
View postsql.sql
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8
-- Inspired by
-- JSON Types need to be mapped into corresponding PG types
Mparaiso / latency.txt
Created Apr 4, 2017 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
Mparaiso / jsonparse.js
Created Feb 24, 2017 — forked from creationix/jsonparse.js
event-only version of jsonparse
View jsonparse.js
// Named constants with unique integer values
var C = {};
// Tokenizer States
var START = C.START = 0x11;
var TRUE1 = C.TRUE1 = 0x21;
var TRUE2 = C.TRUE2 = 0x22;
var TRUE3 = C.TRUE3 = 0x23;
var FALSE1 = C.FALSE1 = 0x31;
var FALSE2 = C.FALSE2 = 0x32;
var FALSE3 = C.FALSE3 = 0x33;
View dnx gen controller
$ dnx gen controller --help
Finding the generator 'controller'...
Running the generator 'controller'...
Usage: controller [options]
--help|-h|-? Show help information
--useAsyncActions|-async Switch to indicate whether to generate async controller actions
Mparaiso / scopes.txt
Created Apr 8, 2016 — forked from iambibhas/scopes.txt
Sublime Text 2: Snippet scopes
View scopes.txt
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
View go_scp.go
package main
import (
const privateKey = `content of id_rsa`
Mparaiso / html.snippet.json
Last active Aug 29, 2015
html.snippet.json : file should be put in the share\liteide\packages\html folder of the liteide installation
View html.snippet.json
"info": "html5 boilerplace",
"name": "html:5",
"text": "<!DOCTYPE html><html lang=\"en\">\n\t\t<head>\n\t\t\t<meta charset=\"UTF-8\" />\n\t\t\t<title>$$</title></head>\n\t\t<body>$$</body>\n</html>"
"info": "html",
"name": "html",
"text": "<html>$$</html>"