Skip to content

Instantly share code, notes, and snippets.

View carlosedp's full-sized avatar

Carlos Eduardo carlosedp

View GitHub Profile
@carlosedp
carlosedp / downloader.js
Created October 18, 2011 23:33
downloader.js
var http = require("http");
var url = require("url");
var fs = require("fs");
var sys = require('sys');
var config = require('./config');
var emailer = require('./emailer').emailer;
var appLogger = require('./logger').appLogger;
var downloadDirSuffix = config.downloadDirSuffix;
var downloadDir = config.downloadDir;
@carlosedp
carlosedp / highlight.sh
Last active August 29, 2015 14:10
highlight.sh - Highlights/colorizes strings of text
#!/bin/bash
if [ "$#" -eq 0 ]
then
echo ""
echo "Highlights output based on regex and color id"
echo "Usage: cat log.txt | highlight.sh pattern1 31 pattern2 34 pattern 3 32"
echo ""
echo "Color ID"
echo "Black 30"
@carlosedp
carlosedp / destructuring.md
Created October 7, 2016 20:39 — forked from yang-wei/destructuring.md
Elm Destructuring (or Pattern Matching) cheatsheet

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))

let
  (a,b,c) = myTuple
#!/bin/bash
# Set the lb id
LB_ID=$1
read -p "Do you really want to delete LB \"${LB_ID}\"? " -n 1 -r
echo # new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
listeners=($(neutron lbaas-loadbalancer-show ${LB_ID} --format json |grep listeners| grep -o '[a-f0-9-]\{36\}'))
@carlosedp
carlosedp / docker-compose.yml
Created January 19, 2018 14:35
docker-compose.yml - Traefik and Portainer
version: '2'
networks:
monitoring:
services:
traefik:
image: traefik:v1.5.0-rc5
restart: always
U-Boot SPL 2017.09-g5a90a9a (Jan 29 2018 - 14:55:03)
setup_ddr_param 1
booted from eMMC
Trying to boot from MMC1
NOTICE: BL31: v1.3(release):f947c7e
NOTICE: BL31: Built : 14:55:02, Jan 29 2018
NOTICE: BL31:Rockchip release version: v1.3
U-Boot 2017.09-g5a90a9a (Jan 29 2018 - 14:55:17 +0000), Build: jenkins-linux-build-rock-64-180
@carlosedp
carlosedp / gist:5040f4a1b2c97c1fa260a3409b5f14f9
Created February 19, 2018 20:01
Reset Kubernetes cluster with Weave
# Drain and delete the nodes (for each node you have)
kubectl drain kubenode1 --delete-local-data --force --ignore-daemonsets
kubectl delete node kubenode1
# Reset the deployment
sudo kubeadm reset
# On each node
## Reset the nodes and weave
@carlosedp
carlosedp / install_container_service.sh
Created February 21, 2018 16:21
Install Container services (Docker/Kubernetes) on Debian/Ubuntu
#!/bin/bash
echo "Container Linux installation script"
echo "This will install:"
echo " - Docker Community Edition"
echo " - Docker Compose"
echo " - Kubernetes: kubeadm, kubelet and kubectl"
echo ""
set -xeo pipefail
@carlosedp
carlosedp / gist:4df3cd58a489a3c4022f97a474439b90
Created February 21, 2018 16:25
Rock64 Install (Adjust IPs/Hostnames/DNS to your deployment)
# Rock64 Install (Adjust IPs/Hostnames/DNS to your deployment)
Disable NetworkManager and DHCP Client
sudo systemctl stop dhcpcd
sudo systemctl stop NetworkManager
sudo systemctl disable dhcpcd
sudo systemctl disable NetworkManager
sudo systemctl daemon-reload
Message from syslogd@kubemaster1 at Feb 22 22:11:57 ...
kernel:[ 4976.042257] Internal error: Oops: 96000005 [#1] SMP
Message from syslogd@kubemaster1 at Feb 22 22:11:57 ...
kernel:[ 4976.744825] Process store (pid: 21052, stack limit = 0xffffffc0ec790020)
Message from syslogd@kubemaster1 at Feb 22 22:11:57 ...
kernel:[ 4976.749027] Stack: (0xffffffc0ec793a70 to 0xffffffc0ec794000)
Message from syslogd@kubemaster1 at Feb 22 22:11:57 ...