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 / hello_world.txt
Created April 3, 2024 22:43
well yeah first gist created using api
hey there!

Hello World from GitHub

@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
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
frenchbread / example.md
Last active June 18, 2017 23:10
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 'http://127.0.0.1:8000/api/some' -H 'Authorization: JWT <some_token>'
@frenchbread
frenchbread / emqttd-setup.md
Last active March 24, 2017 15:30 — forked from phanimahesh/emqttd-setup.md
Instructions to set up emqttd

Instructions to set up emqttd

  • Clone the repo github.com/emqtt/emq-relx
  • Edit the Makefile:
    • Add emq_plugin_elasticsearch to DEPS
    • Add a line dep_emq_plugin_elasticsearch = git https://github.com/phanimahesh/emq_plugin_elasticsearch preview
  • Edit relx.config file
    • Add following to release tuple:
@frenchbread
frenchbread / script-example.js
Last active March 16, 2017 12:35
NodeJS script to generate bunch of sample data for elasticsearch
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({
host: config.host
})
getAPIKeys () {
const esClient = new ElasticSearch.Client({ host: 'http://nightly.apinf.io:14002' });
const params = {
size: 10,
body: {
sort: [
{
request_at: {
order: 'desc',
},
@frenchbread
frenchbread / srpt.js
Created March 2, 2017 05:56
Iterate through files in dir
const fs = require('fs')
var walk = function (dir, done) {
fs.readdir(dir, (error, list) => {
if (error) {
return done(error)
}
let i = 0;
@frenchbread
frenchbread / migrate-script.js
Created February 28, 2017 22:39
Migrate stuff from one sails server to another
migrate () {
this.notify.info('success')
axios.get(`http://127.0.0.1:1337/servers?limit=1000`)
.then(res => {
const servers = res.data
this.notify.info('Success', `Found ${servers.length} servers.`)
_.forEach(servers, server => {
this.apiServers.add(server)
.then(res => console.log(res))
.catch(err => console.error(err))