Skip to content

Instantly share code, notes, and snippets.

View sgnn7's full-sized avatar
🤔
ǝʌᴉʇɔǝdsɹǝd ɹnoʎ ǝƃuɐɥƆ

Srdjan Grubor sgnn7

🤔
ǝʌᴉʇɔǝdsɹǝd ɹnoʎ ǝƃuɐɥƆ
View GitHub Profile
@sgnn7
sgnn7 / get_latest_kernel.sh
Last active June 13, 2018 05:51
Fetches latest mainline kernel from upstream Ubuntu and verifies the validity of the files retrieved
#!/bin/bash -e
CURRENT_DIR=$(pwd)
BASE_URI="http://kernel.ubuntu.com/~kernel-ppa/mainline"
FINGERPRINT="60AA 7B6F 3043 4AE6 8E56 9963 E50C 6A09 17C6 22B0"
ARCH=$(dpkg --print-architecture)
declare -A FILES=([sources]="SOURCES" \
[commit]="COMMIT" \
[linux-image]="linux-image- generic_ ${ARCH}" \
# project nfd (0.5.0) configured on Thu Jan 12 19:43:23 2017 by
# waf 1.8.9 (abi 98, python 2070bf0 on linux2)
# using ./waf configure --prefix=/usr --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib/arm-linux-gnueabihf --libexecdir=/usr/lib/arm-linux-gnueabihf --without-websocket --without-libpcap
#
----------------------------------------
Setting top to
/usr/src/packages/BUILD/nfd-0.5.0+dev1.2d26161
----------------------------------------
Setting out to
/usr/src/packages/BUILD/nfd-0.5.0+dev1.2d26161/build
@sgnn7
sgnn7 / iptables-block-repeating-offenders.conf
Last active October 27, 2016 20:12
fail2ban permanent ban configuration
# Fail2Ban configuration file
#
# Author: Srdjan Grubor <[email protected]>
[Definition]
# Option: actionstart
# Notes: Executed once at start of Fail2Ban.
# Values: CMD
actionstart = iptables -N fail2ban-PERMABAN-LOGGER
@sgnn7
sgnn7 / haproxy_cluster_vars.conf
Created June 15, 2016 14:19
Seamless haproxy on marathon-lb w/ systemd
# /etc/systemd/system/haproxy.service.d/haproxy_cluster_vars.conf
[Service]
Environment="PIDFILE=/run/haproxy.pid"
Environment="HAPROXY_SOCKET=/var/run/haproxy/socket"
# Get rid of the socket on start/stop
ExecStartPre=/bin/bash -c "rm -f $HAPROXY_SOCKET"
ExecStopPost=/bin/bash -c "rm -f $HAPROXY_SOCKET"
# XXX: Do seamless reloads
APP_NAME=foobar
TASK_INDEX=0
LOG_TYPE=stderr # or stdout
MARATHON_HOST="marathon.host.local"
SCHEME=https
MARATHON_TASK_URI="$SCHEME://$MARATHON_HOST/v2/apps/$APP_NAME?embed=app.tasks"
app_info=$(curl "$MARATHON_TASK_URI")
app_task=$(echo ${app_info} | jq -r ".app.tasks[$TASK_INDEX]")
@sgnn7
sgnn7 / setup_ansible.sh
Created April 11, 2016 16:03
Apply custom patches to ansible
#!/bin/bash -e
echo WARNING! This script will add various junk to your
echo WARNING! machine so it is best to run it in a VM!
echo Fetching latest ansible
prerequisites="git \
python \
python-boto \
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 4.2.0-19-generic Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_PERF_EVENTS_INTEL_UNCORE=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
(12:59:23 PM) JohnO: sgnn7 connect from where?
(12:59:41 PM) JohnO: I use mesos-dns often times, are you saying from within the app?
(01:01:13 PM) sgnn7: JohnO: yeah from within the app. host has localhost:<port> on HAproxy going to the right place but the question is accessing that from the app itself
(01:01:40 PM) JohnO: Ah, there is a PORTS variable in Marathon to know how to access it on the host itself
(01:01:51 PM) sgnn7: it's bridged networking though
(01:01:53 PM) JohnO: then you can use the $HOST:$PORT variables
(01:01:56 PM) JohnO: ya
(01:02:09 PM) JohnO: so that would allow the container to connect to the ports external port (I think)
(01:02:39 PM) sgnn7: sadly for our service discovery we're trying to avoid putting in env var resolution but I did find that as well
(01:02:40 PM) cheus left the room (quit: Ping timeout: 260 seconds).
@sgnn7
sgnn7 / .gitignore
Last active January 25, 2016 23:00
Build mesos.deb with Docker
*.deb
build/
@sgnn7
sgnn7 / enable_mongo.sh
Created December 22, 2015 23:06
Mongodb 3.2 on Ubuntu 15.10
echo '[Unit]
Description=High-performance, schema-free document-oriented database
After=syslog.target network.target
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod -f /etc/mongod.conf
[Install]