Skip to content

Instantly share code, notes, and snippets.

View frenchbread's full-sized avatar
🎯
Focusing

Damir Mustafin frenchbread

🎯
Focusing
  • Wunderdog Oy
  • Finland
View GitHub Profile
@frenchbread
frenchbread / snippets.cson
Created August 30, 2016 11:51
Some useful snippets for meteor development in Atom
'.source.js':
'import':
'prefix': 'import'
'body': "import { ${1:title} } from '${2:package-name}';"
'import-meteor':
'prefix': 'import-meteor'
'body': "import { Meteor } from 'meteor/meteor';"
'import-templating':
'prefix': 'import-templating'
'body': "import { Template } from 'meteor/templating';"
-spec get_timestamp() -> integer().
get_timestamp() ->
{Mega, Sec, Micro} = os:timestamp(),
(Mega*1000000 + Sec)*1000 + round(Micro/1000).
tpl2str(Req) ->
Timestamp = get_timestamp(),
{_,[_,Method,Path|Rest]} = Req,
Bucket = [Timestamp,{Method,Path}],
lists:flatten(io_lib:format("~p", [Bucket])).
@frenchbread
frenchbread / mongo_Export_and_Import.sh
Created October 6, 2016 13:50
Scripts to export & import mongodb data
mongodump -h 127.0.0.1 --port 3001 -d meteor
mongorestore -h 127.0.0.1 --port 3001 -d meteor dump/meteor
@frenchbread
frenchbread / ee.txt
Created October 11, 2016 13:10
config for router
spanning-tree mode pvst
!
class-map type inspect match-all LAN-TO-WAN-CLASS
match access-group name LAN-TO-WAN
class-map type inspect match-all WAN-TO-LAN
match access-group name WAN-TO-LAN
class-map type inspect match-all WAN-TO-LAN-CLASS
match access-group name WAN-TO-LAN
class-map type inspect match-all LAN-TO-DMZ-CLASS
match access-group name LAN-TO-DMZ
@frenchbread
frenchbread / useful.erl
Created October 11, 2016 23:48
Some code from emqttd
-spec get_timestamp() -> integer().
get_timestamp() ->
{Mega, Sec, Micro} = os:timestamp(),
(Mega*1000000 + Sec)*1000 + round(Micro/1000).
tuple_to_string(Req) ->
Timestamp = get_timestamp(),
{_,[_,Method,Path|Rest]} = Req,
Bucket = [Timestamp,{Method,Path}],
lists:flatten(io_lib:format("~p", [Bucket])).
@frenchbread
frenchbread / mongodb_output.js
Last active October 19, 2016 00:46
MongoDB output that was generated using emqttd analytics plugin.
{
"_id" : ObjectId("5806bf7f83152983d5000001"),
"type" : "on_session_created",
"date" : ISODate("2016-10-19T00:34:07.513Z"),
"client_id" : "C_1476837240716",
"username" : "admin"
}
{
"_id" : ObjectId("5806bf7f83152983d5000002"),
"type" : "on_client_connected",
@frenchbread
frenchbread / mongodump.js
Created October 29, 2016 06:31
Example of data buckets logged by emqttd to mongodb
module.exports = [
{
"_id" : ObjectId("<obj_id>"),
"type" : "on_client_connected",
"date" : ISODate("2016-10-19T13:34:30.134Z"),
"client_id" : "C_1476884060951"
},
{
"_id" : ObjectId("<obj_id>"),
"type" : "on_client_disconnected",
@frenchbread
frenchbread / mongo_dump.md
Created December 30, 2016 01:35
Commands for mongo dump & restore
  • Dump - mongodump -h 127.0.0.1 --port 3001 -d meteor

  • Restore - mongorestore -h 127.0.0.1 --port 3001 -d meteor dump/meteor

@frenchbread
frenchbread / commands.md
Created January 14, 2017 20:38
Copy and paste stuff in/from terminal

Commands

  • pbcopy
  • pbpaste

Usage examples

To copy:

$ echo 'lol' | pbcopy
@frenchbread
frenchbread / howto.md
Last active November 14, 2020 17:53
Update Node.js with NVM and keep packages

Update Node.js with NVM and keep packages

Usually when new version of Node.js comes out and you update it by just installing new and removing old one, all of your global NPM packages are gone. Here is how to update to new version of Node and reinstall packages:

Command

$ nvm install NEW_VERSION --reinstall-packages-from=OLD_VERSION