Skip to content

Instantly share code, notes, and snippets.

View jamesmoriarty's full-sized avatar
🔮
0xc0000005

James Moriarty jamesmoriarty

🔮
0xc0000005
View GitHub Profile
@jamesmoriarty
jamesmoriarty / delete-custom-metrics
Last active December 2, 2023 20:18
Google Cloud Platform delete custom metrics via REST api
#!/bin/bash
set -x
set -e
project="XXX"
prefix="http"
metrics=$(
curl \
@jamesmoriarty
jamesmoriarty / pi.sh
Last active October 4, 2022 12:25
Raspberry Pi - hfs+, external disk, samba, minidlna, transmission
sudo raspi-config
sudo reboot
# mount external disk
sudo apt-get install hfsplus hfsutils hfsprogs
sudo mkdir /media/usb0
sudo nano /etc/fstab
# /dev/sda2 /media/usb0 hfsplus defaults,force,gid=pi,uid=pi,noatime 0 0
sudo chown -R root:users /media/usb0/
sudo chmod -R ug=rwx,o=rx /media/usb0/

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@jamesmoriarty
jamesmoriarty / example.sh
Created May 7, 2022 11:24
Dump Docker image contents without shell access
$ docker export $(docker ps -lq) | tar tf - | egrep config
usr/sbin/tzconfig
usr/share/man/man5/config.5ssl.gz
usr/share/man/man5/x509v3_config.5ssl.gz
@jamesmoriarty
jamesmoriarty / gohack.mermaid
Last active January 1, 2022 00:01
gohack.exe sequence diamgram
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jamesmoriarty
jamesmoriarty / http-connect-proxy.rb
Last active September 26, 2021 00:25
HTTP CONNECT by example
require 'socket'
listen_socket = TCPServer.new('127.0.0.1', 9292)
client_conn = listen_socket.accept
request_line = client_conn.gets
while(line = client_conn.gets) do
break unless line.include?(':')
end
@jamesmoriarty
jamesmoriarty / monzo-alertmanager-config.yaml
Created April 7, 2021 12:16 — forked from milesbxf/monzo-alertmanager-config.yaml
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
button {
margin-left: 5px;
}
input {
margin: 5px;
}
form {
padding-right: 10px;
conky.config = {
own_window_argb_visual = true,
own_window_argb_value = 0,
double_buffer = true,
alignment = 'middle_right',
background = false,
border_width = 1,
cpu_avg_samples = 10,
default_color = '#FFF',
default_outline_color = '#333',
@jamesmoriarty
jamesmoriarty / docker-copy
Created January 28, 2020 06:02
Docker Image Copy Files
#!/bin/sh
# ./docker-copy a25dae391089 /bin/prometheus ./
id=$(docker create $1)
docker cp $id:$2 $3
docker rm -v $id