Skip to content

Instantly share code, notes, and snippets.

@aisrael
aisrael / no_kill.json
Created December 18, 2017 10:17
Demonstrating seccomp on Docker
$ docker run --rm -it alpine:2.7 sh
/ # sleep 30 &
/ # ps -a
PID USER TIME COMMAND
1 root 0:00 sh
5 root 0:00 sleep 30
6 root 0:00 ps -a
/ # kill 5
/ #
@aisrael
aisrael / gitlab-ci-tests.rb
Last active January 17, 2018 15:18
A short Ruby script to run tests from `.gitlab-ci.yml` using Docker
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'yaml'
GITLAB_CI_YML = File.expand_path('.gitlab-ci.yml')
puts "Using #{GITLAB_CI_YML}"
def sys(cmd)
$ curl -L https://iterm2.com/shell_integration/install_shell_integration_and_utilities.sh | bash
######################################################################## 100.0%
Downloading script from https://iterm2.com/shell_integration/bash and saving it to /Users/aisrael/.iterm2_shell_integration.bash...
Checking if /Users/aisrael/.bash_profile contains iterm2_shell_integration...
Downloading imgcat...
Downloading imgls...
Downloading it2attention...
Downloading it2check...
Downloading it2copy...
Downloading it2dl...

Keybase proof

I hereby claim:

  • I am aisrael on github.
  • I am aisrael (https://keybase.io/aisrael) on keybase.
  • I have a public key whose fingerprint is 47E6 A57D 0AEE C009 5396 DF54 635C 3498 903F 3A91

To claim this, I am signing this object:

@aisrael
aisrael / my_table.js.jsx
Created June 29, 2016 14:50
React + $.ajax
class MyTable extends React.Component {
constructor(props) {
super(props);
$.ajax({
url: 'localhost/path',
dataType: 'json',
cache: true,
success: function (resp) {
console.log(this);
this.state = resp.data;
type ApiResponse struct {
RawItems []json.RawMessage `json:"items"`
HasMore bool `json:"has_more"`
QuotaMax int `json:"quota_max"`
QuotaRemaining int `json:"quota_remaining"`
}
type Owner struct {
// ...
}
@aisrael
aisrael / git-backport-log
Last active August 29, 2015 14:17
git-backport-log
#!/usr/bin/env python
import re
# Needs https://github.com/gitpython-developers/GitPython, pip install gitpython
from git import Repo
repo = Repo('.')
active_branch = repo.active_branch.name
@aisrael
aisrael / git-ignore.rb
Last active August 29, 2015 14:08
Provides a `git ignore` command that'll append the given argument(s) to the `.gitignore` file, but only if they wouldn't be matched by existing entries.
#!/usr/bin/env ruby
#
# Place this in your executable path (e.g. "~/bin/git-ignore")
# and you should now be able to go: git ignore [path/argspec]
# Exit on error (e.g., "Not a git repository")
`git rev-parse --show-toplevel`.chomp
exit(1) unless $?.success?
if ARGV.empty?
@aisrael
aisrael / docker_bashrc
Last active August 29, 2015 14:01
A bunch of useful bash functions and aliases for Docker.
# Use 'docker.io' if using the official packages on Ubuntu 14.04+
alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
drm() { docker rm ; }
dri() { docker rmi ; }
alias dkd="docker run -d -P"
alias dki="docker run -t -i -P"
alias docker_rmi_all='docker rmi $(docker images|tail -n +2|awk '\''{print $1":"$2}'\'')'
#####
@aisrael
aisrael / git-export
Last active August 29, 2015 14:00
Provides a "git export" command similar to "svn export" that exports the current index (including all submodules) to the target path.
#!/bin/bash
#
# Place this in your executable path (e.g. "~/bin/git-export")
# and you should now be able to go: git export [path]
PWD=$(pwd)
# Exit on error (e.g., "Not a git repository")
set -e
TOP_LEVEL=$(git rev-parse --show-toplevel)