Skip to content

Instantly share code, notes, and snippets.

View schlomo's full-sized avatar

Schlomo Schapiro schlomo

View GitHub Profile
@schlomo
schlomo / LICENSE.txt
Last active June 9, 2017 08:41
Simple daily cron job as Kubernetes container image. See http://blog.schlomo.schapiro.org/2017/06/using-kubernetes-with-multiple.html for details.
Copyright 2017 Schlomo Schapiro / Zalando SE
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE O
@schlomo
schlomo / aws-assume-role.sh
Last active February 23, 2022 01:54
Understanding AWS IAM Roles and useful scripts to assume a role. See http://blog.schlomo.schapiro.org/2017/06/understanding-iam-roles-in-amazon-aws.html for details.
#!/bin/bash -eu
die() { echo 1>&2 "ERROR: $*" ; exit 1 ; }
info() { echo 1>&2 "INFO: $*" ; }
test "${1:-}" || die "Usage: $0 <role-name | role ARN> [<role-name | role ARN> ...]"
while test "${1:-}" ; do
role="$1"
shift
@schlomo
schlomo / Vagrantfile
Created May 2, 2017 19:45
Vagrantfile to show the autorelabel bug with centos/7 Vagrant images. See https://github.com/rear/rear-workshop-osbconf-2016/issues/4 and https://bugs.centos.org/view.php?id=13213
# BUG proof for VirtualBox vagrant with centos/7 failing to run autorelabel
#
# before starting install the reload plugin with: vagrant plugin install vagrant-reload
#
# see the bug: vagrant up
# destroy VM: vagrant destroy -f
# see the fix (disable serial console): FIX=1 vagrant up
#
# destroy VM: vagrant destroy -f

Keybase proof

I hereby claim:

  • I am schlomo on github.
  • I am schlomo (https://keybase.io/schlomo) on keybase.
  • I have a public key whose fingerprint is EAE2 A8B2 C84B 7F63 9914 C80E 6D97 452D AD64 9AF2

To claim this, I am signing this object:

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.2 PCI bridg
schlomo@brho:~/src/rpi-image-creator$ ./rpi-image-creator /dev/sdd
Switching over to run as root
Fetching http://downloads.raspberrypi.org/raspbian/images/raspbian-2015-02-17/2015-02-16-raspbian-wheezy.zip
Checksum of download/2015-02-16-raspbian-wheezy.zip: OK
Loop-back mounting temp/2015-02-16-raspbian-wheezy.img
Raspbian Image Details:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/loop0p1 56M 15M 42M 26% mnt/img_root/boot
/dev/mapper/loop0p2 2.9G 2.3G 462M 84% mnt/img_root
Modifying Image
schlomo@brho:~/src/rpi-image-creator$ ./rpi-image-creator --chroot
Switching over to run as root
Fetching http://downloads.raspberrypi.org/raspbian/images/raspbian-2015-02-17/2015-02-16-raspbian-wheezy.zip
Checksum of download/2015-02-16-raspbian-wheezy.zip: OK
Loop-back mounting temp/2015-02-16-raspbian-wheezy.img
Raspbian Image Details:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/loop0p1 56M 15M 42M 26% mnt/img_root/boot
/dev/mapper/loop0p2 2.9G 2.3G 462M 84% mnt/img_root
Modifying Image
APT::FTPArchive::Release::Origin "Schlomo";
APT::FTPArchive::Release::Label "Schlomo Stable";
APT::FTPArchive::Release::Architectures "amd64 armhf armel i386";
APT::FTPArchive::Release::Description "Private Packages";
@schlomo
schlomo / putinrepo.sh
Created February 18, 2015 21:12
Simple DEB repository management. See http://blog.schlomo.schapiro.org/2015/02/simplified-deb-repository.html for full story
#!/bin/bash
#
# Trivial DEB repo management
#
# Written by Schlomo Schapiro
# Licensed under the GNU General Public License, see http://www.gnu.org/licenses/gpl.html for full text
set -e -E -u
if [[ ! "${REPO_BASE_DIR:-}" ]] ; then
ME_DIR="$(dirname "$(readlink -f "$0")")"
for CHECK_DIR in "$ME_DIR" "$ME_DIR"/../repo "$ME_DIR"/repo ; do
@schlomo
schlomo / auto.sh
Created February 7, 2015 19:18
Ubuntu guest session configuration. This script runs as the guest user and should be installed as /etc/guest-session/auto.sh
gsettings set org.gnome.desktop.lockdown disable-user-switching true
gsettings set org.gnome.desktop.session idle-delay 0
gsettings set com.canonical.indicator.session suppress-restart-menuitem true
gsettings set com.canonical.indicator.session suppress-shutdown-menuitem true
gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Alt>Shift_L']"
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'de+deadgraveacute'), ('xkb', 'il')]"
gsettings set com.canonical.indicator.datetime show-day true
gsettings set com.canonical.indicator.datetime show-seconds true
gsettings set com.canonical.indicator.datetime show-date true
gsettings set com.canonical.indicator.datetime show-week-numbers true