Skip to content

Instantly share code, notes, and snippets.

Damir Mustafin frenchbread

Block or report user

Report or block frenchbread

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View hackathon.js
const _ = require('lodash')
const components = {
blaster: {
tasks: [
{ name: 'ystanovka_lazera_blastera_v_korpus', worker: 'shturmoviki' },
{ name: 'polirovka_rukoyati_blastera', worker: 'sborshiki' },
{ name: 'zaryad_batarey_blastera', worker: 'akkumulyatori' },
{ name: 'pristrelka', worker: 'shturmoviki' }
frenchbread /
Last active Jun 18, 2017
curl POST request with JSON data example
curl -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' http://localhost:3000/api/login
curl -XGET '' -H 'Authorization: JWT <some_token>'
frenchbread /
Last active Mar 24, 2017 — forked from phanimahesh/
Instructions to set up emqttd

Instructions to set up emqttd

  • Clone the repo
  • Edit the Makefile:
    • Add emq_plugin_elasticsearch to DEPS
    • Add a line dep_emq_plugin_elasticsearch = git preview
  • Edit relx.config file
    • Add following to release tuple:
View example-method.js
getAPIKeys () {
const esClient = new ElasticSearch.Client({ host: '' });
const params = {
size: 10,
body: {
sort: [
request_at: {
order: 'desc',
frenchbread / srpt.js
Created Mar 2, 2017
Iterate through files in dir
View srpt.js
const fs = require('fs')
var walk = function (dir, done) {
fs.readdir(dir, (error, list) => {
if (error) {
return done(error)
let i = 0;
frenchbread / migrate-script.js
Created Feb 28, 2017
Migrate stuff from one sails server to another
View migrate-script.js
migrate () {'success')
.then(res => {
const servers ='Success', `Found ${servers.length} servers.`)
_.forEach(servers, server => {
.then(res => console.log(res))
.catch(err => console.error(err))
frenchbread / script-example.js
Last active Mar 16, 2017
NodeJS script to generate bunch of sample data for elasticsearch
View script-example.js
import moment from 'moment'
import es from 'elasticsearch'
import uuid from 'node-uuid'
import _ from 'lodash'
import config from '/config'
const client = new es.Client({
server {
    listen 80;

    server_name <public_IP>;

    location / {
        proxy_pass http://localhost:18083;
        proxy_http_version 1.1;
frenchbread /
Created Jan 17, 2017
Show/hide hidden files on mac

Show/hide hidden files on mac

$ defaults write AppleShowAllFiles YES


frenchbread /
Last active Feb 25, 2019
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:


$ nvm install NEW_VERSION --reinstall-packages-from=OLD_VERSION
You can’t perform that action at this time.