Skip to content

Instantly share code, notes, and snippets.

View miqui's full-sized avatar

Miguel Quintero miqui

View GitHub Profile
@miqui
miqui / create-pwd.sh
Created December 12, 2017 18:15
create a pwd
#~/usr/bin/env bash
openssl rand -base64 32 | base64 | head -c 24 ; echo
@miqui
miqui / sample-git-commands.md
Created December 7, 2017 20:06
sample git commands and go stuff

git push for master

git remote add fork git branch -a

git checkout -b

git log --pretty=format:"%h - %an, %ar : %s" git log --oneline --decorate

@miqui
miqui / python-shell-cli.py
Created December 7, 2017 05:03
python shell cli
import subprocess
time = subprocess.Popen("ls -la",shell=True, stderr=subprocess.PIPE)
output, err = time.communicate()
print ('It is', output)
# example 2
import subprocess
import sys
@miqui
miqui / golang-cli.go
Created December 7, 2017 04:04
gh golang cli
package main
import (
"fmt"
"os"
"os/exec"
)
func main() {
var (
cadvisor_version_info{cadvisorRevision="4957b7a",cadvisorVersion="v0.27.2",dockerVersion="17.06.1-ee-2",env="production",group="master",instance="myhost:8080",job="cadvisor-masters",kernelVersion="3.10.0-693.1.1.el7.x86_64",osVersion="Alpine Linux v3.4"} 1
cadvisor_version_info{cadvisorRevision="4957b7a",cadvisorVersion="v0.27.2",dockerVersion="17.06.1-ee-2",env="production",group="master",instance="myhost:8080",job="cadvisor-masters",kernelVersion="3.10.0-514.el7.x86_64",osVersion="Alpine Linux v3.4"} 1
@miqui
miqui / bash-wait-loop.md
Created October 2, 2017 00:58
bash loop wait until
# this for loop waits until .....
for i in {1..150} # timeout for 5 minutes
do
   ./{command_here} &> /dev/null
   if [ $? -ne 1 ]; then
      break
  fi
  sleep 2
done
@miqui
miqui / gen-cert.md
Last active September 20, 2017 07:09
gen cert

With OpenSSL:

Generate the private key:

openssl genrsa -out private.key 2048 Generate the self-signed certificate:

openssl req -new -x509 -days 3650 -key private.key -out public.crt -subj "/C=US/ST=state/L=location/O=organization/CN=domain"

@miqui
miqui / creating-self-signed-certificates.md
Created September 20, 2017 07:08 — forked from Themitchell/creating-self-signed-certificates.md
Creating Self Signed Certificates

Creating Self Signed Certificates for use with Node and Chrome

Creating the certificate files

  1. Generate a private key with open ssl.

    $ openssl genrsa -des3 -out /var/lib/ssl/self-signed.key 1024
  2. Generate a CSR (Certificate Signing Request).

@miqui
miqui / golang-setup.md
Last active September 18, 2017 03:36
golang setup

INSTALLING GO

Preferred Method (Windows, Mac, Linux) Download the latest installer from go: http://golang.org/dl/ Mac - Using Home Brew It's preferred that you download and install the package. However, if you are a homebrew user, you can use the following commands:

$ brew update
$ brew install go

Linux - Using APT

go get -u -v github.com/golang/protobuf/... Thu Aug 17 13:49:06 2017
github.com/golang/protobuf (download)
github.com/golang/protobuf/protoc-gen-go/descriptor
github.com/golang/protobuf/ptypes/struct
github.com/golang/protobuf/ptypes/any
github.com/golang/protobuf/ptypes/duration
github.com/golang/protobuf/ptypes/timestamp
github.com/golang/protobuf/ptypes/wrappers
github.com/golang/protobuf/proto/testdata
github.com/golang/protobuf/ptypes/empty