Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Remote all exited container
docker rm $(docker ps -q -f status=exited)
# Remote none tag images (image with tag <none>)
docker images | grep "<none>" | awk '{print $3}' |xargs docker rmi -f
# Remove all images that is not using by any running container
# note: docker ps --format {{.Image} -> List all images of running container then set it as grep pattern
@roscopecoltran
roscopecoltran / .gitignore
Created June 24, 2018 21:46 — forked from samrocketman/.gitignore
A gitignore for ignoring common binary files
#common document extensions (case insensitive)
**.[pP][dD][fF]
**.[dD][oO][cC]
**.[dD][oO][tT]
**.[dD][oO][cC][xX]
**.[dD][oO][cC][mM]
**.[dD][oO][tT][xX]
**.[dD][oO][tT][mM]
**.[dD][oO][cC][bB]
**.[pP][pP][tT][xX]
@roscopecoltran
roscopecoltran / monorepo.md
Created June 24, 2018 19:07 — forked from arschles/monorepo.md
Why We Should Use Monolithic Repositories

I think we should have all our code in a monolithic repository.

I've detailed the big benefits to having one, addressed possible issues to having one, and mentioned a few risks to not moving to a monorepo below.

Benefits To Adopting a Monolithic Repo

Golang package dependencies

  1. Single vendor/ dir at the top level of deis/deis
  2. All internal packages use the same external dependencies
@roscopecoltran
roscopecoltran / gist:b04b3b85fdc60994088f290f96f6dc25
Created June 24, 2018 18:12 — forked from managai/gist:1292409
(bash) Measure Elapsed Time
#!/bin/bash
#
# Elapsed time. Usage:
#
# t=$(timer)
# ... # do something
# printf 'Elapsed time: %s\n' $(timer $t)
# ===> Elapsed time: 0:01:12
#
#
@roscopecoltran
roscopecoltran / gitcreate.sh
Created June 20, 2018 09:37 — forked from robwierzbowski/gitcreate.sh
A simple litte script. Create and push to a new github repo from the command line.
#!/bin/bash
# https://gist.github.com/robwierzbowski/5430952/
# Create and push to a new github repo from the command line.
# Grabs sensible defaults from the containing folder and `.gitconfig`.
# Refinements welcome.
# Gather constant vars
CURRENTDIR=${PWD##*/}
GITHUBUSER=$(git config github.user)
@roscopecoltran
roscopecoltran / Matrix.md
Created May 27, 2018 17:50 — forked from nadavrot/Matrix.md
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@roscopecoltran
roscopecoltran / knuth.go
Created May 8, 2018 07:18 — forked from quux00/knuth.go
Knuth Fisher-Yates shuffle for Go (golang)
// implements Knuth or Fisher-Yates shuffle
package knuth
import (
"math/rand"
"time"
)
func init() {
rand.Seed(time.Now().UTC().UnixNano())
@roscopecoltran
roscopecoltran / rabbitmq_go_sample.go
Created April 11, 2018 14:52 — forked from sohamkamani/rabbitmq_go_sample.go
An example of a simple pub-sub workflow for rabbitmq in go
package queue
import (
"fmt"
"log"
"github.com/streadway/amqp"
)
var conn *amqp.Connection
@roscopecoltran
roscopecoltran / webpack4upgrade.md
Created March 19, 2018 01:28 — forked from gricard/webpack4upgrade.md
Just some notes about my attempt to upgrade to webpack 4

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ [email protected]
added 1 package, removed 20 packages and updated 4 packages in 13.081s

Cool! Ok...

@roscopecoltran
roscopecoltran / pwnd.js
Created February 27, 2018 15:03 — forked from jgrahamc/pwnd.js
Cloudflare Workers that adds an "Cf-Password-Pwnd" header to a POST request indicating whether the 'password' field appears in Troy Hunt's database of pwned passwords.
addEventListener('fetch', event => {
event.respondWith(fetchAndCheckPassword(event.request))
})
async function fetchAndCheckPassword(req) {
if (req.method == "POST") {
try {
const post = await req.formData();
const pwd = post.get('password')
const enc = new TextEncoder("utf-8").encode(pwd)