Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
# From PowerShell ADMINISTRATOR session run
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
# Open new PowerSheel Administrator session and run
# $cred=Get-Credential domain\username (can also use [email protected] MSA style username)
# Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/tylergibson/bd7a4c923db6bc0bd0a3ca05473dd4f7/raw -Credential $cred
# Initialize reboot log file
$reboot_log = "C:\installation.rbt"
if ( -not (Test-Path $reboot_log) ) { New-Item $reboot_log -type file }
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) {
@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 / 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

Setup

curl -sSL -o clone.c goo.gl/G45N5X

Net Namespace

# on host
@cicorias
cicorias / clone.c
Created September 15, 2017 02:59 — forked from jessfraz/clone.c
clone.c
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <sched.h>
#include <sys/wait.h>
#include <errno.h>
#define STACKSIZE (1024*1024)
static char child_stack[STACKSIZE];

Self isolating binaries

This is a play proposal for a new wrapper around go build that would build your binary but wrap it in code that would prepare isolation around your binary on run.

A concept of this is in https://github.com/jfrazelle/binctr, in that it takes a docker image and embeds the contents into a final binary so you have a self-contained binary.

The binctr example is unnessesarily heavy for go binaries because all you need is a completely static binary.

@cicorias
cicorias / fix-xcode.rb
Created October 6, 2017 22:36 — forked from vineetchoudhary/fix-xcode.rb
Quick fix to all your Xcode SDK issues. When you update Xcode, just run this script and all is well.
#!/usr/bin/env ruby
# fix-xcode
# Mark Rickert <[email protected]>
# Symlinks all your old SDKs to Xcode.app every time it is updated.
# Create a directory called /SDKs and run this script.
#
# Each time you upgrade Xcode, run fix-xcode.