Skip to content

Instantly share code, notes, and snippets.

View jkomyno's full-sized avatar
🏠
Working from home

Alberto Schiabel jkomyno

🏠
Working from home
View GitHub Profile
@jkomyno
jkomyno / index.js
Created February 20, 2017 18:54
Twilio boilerplate server in NodeJS
const app = require('express')();
const bodyParser = require('body-parser');
const ACCOUNT_SID = '';
const AUTH_TOKEN = '';
const FROM_NUMBER = '';
const TwilioClient = require('twilio')(ACCOUNT_SID, AUTH_TOKEN);
app.use(bodyParser.json());
@jkomyno
jkomyno / rec_rm.sh
Last active January 31, 2017 07:50
Snippet to recursively remove folder
find . -type d -name 'CVS' -exec rm -r {} +
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Single Page Apps for GitHub Pages</title>
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// https://github.com/rafrex/spa-github-pages
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License
// ----------------------------------------------------------------------
@jkomyno
jkomyno / w.bat
Created January 6, 2017 11:56
Simple Batch script to speed up new project creation o projects navigation
@echo off
IF %1 == r GOTO first
IF %1 == rn GOTO second
:first
set v1=react
GOTO cmd1
:second
@jkomyno
jkomyno / get_ips.sh
Created January 2, 2017 15:46
Get all the IP addresses that failed to login from the secure log.
# get_ips.sh
grep "Failed password for" /var/log/auth.log \
| grep -Po "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" \
| sort \
| uniq -c
@jkomyno
jkomyno / client.js
Created November 9, 2016 14:06
NodeJS http.Server handles ~3,400 requests per second, net.Server handles ~5,500 requests per second.
// This makes two connections, one to a tcp server, one to an http server (both in server.js)
// It fires off a bunch of connections and times the response
// Both send strings.
const net = require(`net`);
const http = require(`http`);
function parseIncomingMessage(res) {
return new Promise((resolve) => {
@jkomyno
jkomyno / makeDfJSON.sh
Created September 30, 2016 06:43
Sometimes awk >>> python and Co
#!/bin/bash
df -h $1 | awk '
BEGIN { ORS = ""; print "[" }
/Filesystem/ {next}
{ printf "%s{\"fs\": \"%s\", \"size\": \"%s\", \"used\": \"%s\", \"available\": \"%s\"}",
separator, $1, $2, $3, $4
separator = ", "
}
END { print "]" }
@jkomyno
jkomyno / getGlobalPackages.sh
Created September 28, 2016 10:54
Get every globally install npm package
npm list -g --depth 0
@jkomyno
jkomyno / .travis.yml
Last active September 22, 2016 12:44
Bash script to enable node-gyp build in Debian/Ubuntu etc. This is needed for every modern NodeJS version.
before_install:
- sudo apt-get install python-software-properties
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update
- sudo apt-get install gcc-5 g++-5
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 80 --slave /usr/bin/g++ g++ /usr/bin/g++-5
- sudo update-alternatives --set gcc /usr/bin/gcc-5