Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
docker system prune -f
FOR /f "tokens=*" %i IN ('docker ps -a -q') DO docker rm %i
FOR /f "tokens=*" %i IN ('docker images -q -f "dangling=true"') DO docker rmi %i
sudo curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)"
function exponentialBackoff(toTry, max, delay, callback) {
new Promise(function(resolve, reject) {
// do a thing then…
var ret = toTry.toString();
ret = ret.substr('function '.length);
ret = ret.substr(0, ret.indexOf('('));
console.log('EB '+ret+' max',max,'next delay',delay);
var result = toTry();
if (result) {
git config --global core.autocrlf false
#* text=auto
* text=auto eol=lf
*.js text eol=lf
{
"files.eol": "\n",
"editor.tabSize": 2,
// let tries = 0;
// function connectSql() {
// sql.globalConnection.connect(config.get('db.connectionstring'))
// .then( (pool) => {
// winston.warn('connected....');
// })
// .catch((err) => {
// tries++;
// winston.error(`Error creating connection pool: at ${tries} tries`);
@cicorias
cicorias / git_notes.md
Created August 30, 2017 11:03 — forked from jaygooby/git_notes.md
Git, you bloody git

Push all branches to new remote

If you've added a new remote, you might want to push all your branches to it:

git push new-remote --all

View log in different branch

Maybe you want to cherry-pick from a different branch and you need to know the commit hash:

@cicorias
cicorias / breaklease.ps1
Created August 30, 2017 19:43
break a leas on azure storage blob
# Login-AzureRmAccount -ErrorAction Stop
$storageAccounts = Get-AzureRmStorageAccount -ErrorAction Stop
$selectedStorageAccount = $storageAccounts | where-object{$_.StorageAccountName -eq $StorageAccountName}
If($selectedStorageAccount)
{
$key = (Get-AzureRmStorageAccountKey -ResourceGroupName $selectedStorageAccount.ResourceGroupName -name $selectedStorageAccount.StorageAccountName -ErrorAction Stop)[0].value
$storageContext = New-AzureStorageContext -StorageAccountName $selectedStorageAccount.StorageAccountName -StorageAccountKey $key -ErrorAction Stop
$storageContainer = Get-AzureStorageContainer -Context $storageContext -Name $ContainerName -ErrorAction Stop
$blob = Get-AzureStorageBlob -Context $storageContext -Container $ContainerName -Blob $BlobName -ErrorAction Stop
@cicorias
cicorias / dcsl
Created September 4, 2017 23:28 — forked from sheershoff/dcsl
Docker-compose logs sorted by time
#!/bin/bash
usage="Input piped docker-compose logs -t, or a file created from this command, to show logs lines sorted by time.\n\n Usage:\n\n $(basename "$0") [-h|--help] - this message\n $(basename "$0") - runs default docker-compose logs -t and sorts'em\n docker-compose logs -t|$(basename "$0") - pipe logs to this command\n $(basename "$0") my-compose.log - or choose file with logs to display\n\n"
[ $# -ge 1 -a -f "$1" ] && input="$1" || input="-"
case "$1" in
-h|--help) printf "$usage"
exit
;;
esac
if [ -t 0 ]; then
docker-compose logs -t|sort -t "|" -k +2d
@cicorias
cicorias / boxstarter.ps1
Created September 15, 2017 02:52 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <[email protected]>
# Last Updated: 2017-09-11
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# start http://boxstarter.org/package/nr/url?<URL-TO-RAW-GIST>
#
# Learn more: http://boxstarter.org/Learn/WebLauncher
#---- TEMPORARY ---
@cicorias
cicorias / proposal.md
Created September 15, 2017 02:57 — forked from jessfraz/proposal.md
High-Level Security Profile Generator

High-Level Security Profile Generator

(originally from my proposal on moby/moby#17142 (comment) but generic)

The profile would generate artificats of an apparmor profile and seccomp filters.

Obviously doesn't have to be toml since that's super hipster :p

Assumptions

  • no one is going to sit and write out all the syscalls/capabilities their app needs
  • automatic profiling would be super cool but like aa-genprof it is never