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
server {
    listen 80;

    server_name <public_IP>;

    location / {
        proxy_pass http://localhost:18083;
 proxy_http_version 1.1;
@frenchbread
frenchbread / howto.md
Created January 17, 2017 01:36
Show/hide hidden files on mac

Show/hide hidden files on mac

$ defaults write com.apple.finder AppleShowAllFiles YES

or

@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 / 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 / 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 / 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 / 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 / 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 / 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
-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])).