Skip to content

Instantly share code, notes, and snippets.

View marcusdb's full-sized avatar

Marcus David Bronstein marcusdb

  • porto, Portugal
View GitHub Profile
tmux key Description iTerm2 key
C-a Default prefix, used instead of "C-b". Same prefix is used in screen program, and it's easy to type. The only drawback of "C-a" is that underlying shell does not receive the keystroke to move to the beginning of the line.
@marcusdb
marcusdb / macbook-pro-2011-defective-gpu-fix.md
Created December 9, 2019 20:59 — forked from cdleon/macbook-pro-2011-defective-gpu-fix.md
Macbook Pro 2011 GPU Defect fix macOS Sierra and High Sierra
@marcusdb
marcusdb / app.js
Created April 3, 2019 15:38 — forked from johnhunter/app.js
Nodejs chat with socket.io
/*
Websockets using http://socket.io/
Also with express web mvc framework http://expressjs.com/
*/
var app = require('express').createServer(),
io = require('socket.io').listen(app),
port = 88;
@marcusdb
marcusdb / create_certificate.sh
Created January 14, 2019 14:02
create self signed certificate
openssl req -new -x509 -keyout snakeoil-ca-1.key -out snakeoil-ca-1.crt -days 365 -subj '/CN=ca1.test.dev.io/OU=Dev/O=Developer/L=Porto/ST=Porto/C=PT' -passin pass:password -passout pass:password
@marcusdb
marcusdb / observable-recursive.js
Created June 5, 2018 09:39 — forked from Stuff90/observable-recursive.js
Example of a recursive call to an API using Observables
// Example for article : https://medium.com/@simonb90/appels-api-itératifs-avec-rxjs-a1c2593c558b
/*
* Definition of API method:
* getEntitiesByPage(page: number): Observable<Entity[]>
*/
let iterator = new BehaviorSubject<number>(1);
iterator.mergeMap((i) => {
@marcusdb
marcusdb / alert.sh
Created December 17, 2017 18:19 — forked from cherti/alert.sh
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@marcusdb
marcusdb / delete_old_filebeat_indices.sh
Created December 13, 2017 19:55 — forked from ricsiga/delete_old_filebeat_indices.sh
delete old filebeat indices from elasticsearch
#!/bin/bash
index=$(date --date='14 days ago' +%Y.%m.%d)
curl -s -XDELETE "http://localhost:9200/filebeat-$index?pretty"
@marcusdb
marcusdb / install.sh
Created October 18, 2017 17:33 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@marcusdb
marcusdb / Enhanced NGINX logstash parser
Created October 11, 2017 17:36 — forked from csamsel/Enhanced NGINX logstash parser
Enhanced NGINX logstash parser to include upstream response time and request length fields
Enhanced NGINX logstash parser:
NGINX log format:
log_format enhanced '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $request_length "$http_referer" "$http_user_agent" $request_time $upstream_response_time';
access_log /var/log/nginx/access.log enhanced;
error_log /var/log/nginx/error.log;
logstash pattern (/opt/logstash/pattern/nginx):
up vote
336
down vote
accepted
The following command removes all global npm modules. Note: this does not work on Windows. For a working Windows version, see Ollie Bennett's Answer.
npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm