Skip to content

Instantly share code, notes, and snippets.

View dajobe's full-sized avatar

Dave Beckett dajobe

View GitHub Profile
@dergachev
dergachev / squid-deb-proxy_on_docker.md
Last active February 21, 2025 02:49
Caching debian package installation with docker

TLDR: I now add the following snippet to all my Dockerfiles:

# If host is running squid-deb-proxy on port 8000, populate /etc/apt/apt.conf.d/30proxy
# By default, squid-deb-proxy 403s unknown sources, so apt shouldn't proxy ppa.launchpad.net
RUN route -n | awk '/^0.0.0.0/ {print $2}' > /tmp/host_ip.txt
RUN echo "HEAD /" | nc `cat /tmp/host_ip.txt` 8000 | grep squid-deb-proxy \
  && (echo "Acquire::http::Proxy \"http://$(cat /tmp/host_ip.txt):8000\";" > /etc/apt/apt.conf.d/30proxy) \
  && (echo "Acquire::http::Proxy::ppa.launchpad.net DIRECT;" >> /etc/apt/apt.conf.d/30proxy) \
  || echo "No squid-deb-proxy detected on docker host"
@jkreps
jkreps / benchmark-commands.txt
Last active July 9, 2025 07:44
Kafka Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196
@wolfdancer
wolfdancer / ping_and_filesystem_check_server_side_monitoring_configuration.md
Last active August 29, 2015 14:01
Step-by-step Instruction to set up Ping and Filesystem check with Server-Side Monitoring Configuration

Summary

This is a step-by-step instruction to manually set up Cloud Monitoring through the server-side configuration feature to get familiar with the process. The target use case for this is for automation like Chef Cookbook, Ansible Playbook or scripts.

In this example, we are going to set up the filesystem check because it is always a good idea to get notified BEFORE you run out of space. We are going to use Ubuntu as the example OS to simplify the steps.

Steps

  • Upgrade agent
  • Create YAML file
@thaJeztah
thaJeztah / docker-compile.pl
Last active August 29, 2015 14:02 — forked from mpasternacki/docker-compile.pl
Perl script to build a Docker image from Dockerfile that creates the image in a single layer, without any intermediate images. Needs JSON CPAN module (available as `libjson-perl` Debian/Ubuntu package). Usage: run the script in the directory that contains a Dockerfile. More details in a blog post: http://3ofcoins.net/2013/09/22/flat-docker-images/
#!/usr/bin/env perl
use feature 'switch';
use strict;
use warnings;
use Data::Dumper;
use File::Basename;
use File::Copy;
use File::Path qw/make_path/;
@noahlz
noahlz / troubleshooting-with-jcmd.md
Last active May 31, 2019 13:47
Troubleshooting Production JVMs with jcmd

Troubleshooting Production JVMs with jcmd

jcmd is a powerful new tool introduced in Java 7. Along with jstack and jps, it should be in your go-to tool for solving production problems on the JVM. (Come to think of it, with this tool you don't really need jps anymore)

Here's an example session with jcmd:

$ ssh wopr.qa.corp.local
$ jcmd -l
34739 sun.tools.jcmd.JCmd -l
@matthewmueller
matthewmueller / osx-for-hackers.sh
Last active June 23, 2025 13:24
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@adewes
adewes / README.md
Last active August 12, 2024 20:19
Ebay Ads - Bot. Because who wants to write messages by hand...

To use this bot:

  • Download ads_bot.py and requirements.txt.
  • Type pip install -r requirements.txt to install the requirements.
  • Fill out the required information in the Python file.
  • Ideally, create a (free) Slack account and set up a web hook to receive notifications from the bot.
  • Run the script :)
  • Relax and be ready to answer incoming calls :D
@kristopolous
kristopolous / hn_seach.js
Last active July 24, 2023 04:12
hn job query search
// Usage:
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread
// then use as follows:
//
// query(term | [term, term, ...], term | [term, term, ...], ...)
//
// When arguments are in an array then that means an "or" and when they are seperate that means "and"
//
// Term is of the format:
// ((-)text/RegExp) ( '-' means negation )
@jimbaker
jimbaker / build.gradle
Created August 19, 2015 22:30
Gradle build script for Spark. Just enough integration to do something interesting - IntelliJ, shading, unit testing with Scala test, interop with Twilio SDK - without attempting to download the internet.
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '1.2.2'
}
apply plugin: 'idea'
apply plugin: 'scala'
apply plugin: 'com.github.johnrengelman.shadow'
version = 0.1
@lawrenceakka
lawrenceakka / queue_from_track_id.py
Last active October 3, 2019 20:10
A quick demo showing how to add a music service track to the queue
# -*- coding: utf-8 -*-
"""Demo to add a music service track or album to a queue."""
from __future__ import unicode_literals
from soco import SoCo
from soco.data_structures import DidlItem, DidlResource
from soco.music_services import MusicService
from soco.compat import quote_url