Skip to content

Instantly share code, notes, and snippets.

versionName: 2.5.0
versionCode: 420500014
@growse
growse / snapshot-server.py
Created June 27, 2023 11:50
Prometheus snapshot server
#!/usr/bin/env python3
from flask import Flask, jsonify
import requests
import click
app = Flask(__name__)
@growse
growse / keep-trying-to-fsck.sh
Created May 17, 2023 09:24
Keep hitting umount and fsck on a disk until it's clean.
#!/bin/bash
#
ext=100
DEVICE=$1
# Can get the devices / pvcs with this.
#thingies=$( mount | grep ro,|grep pvc| awk '{split($3,path,/\//); print $1 "|" path[9]}')
#for thingie in $thingies
#do
#!/usr/bin/env python3
import pytest
def boing(mass_factor):
little_v = 0
big_v = -1
bounces = 0
@growse
growse / parp.py
Last active April 23, 2018 21:36
Coordinating multiple python2.7 processes, IPC and signals
#!/usr/bin/env python
import logging
import os
import signal
import sys
import multiprocessing
import threading
{
Here -- there [type=s label=Everywhere];
};
@growse
growse / notwinning.java
Created September 27, 2016 10:35
Winning
package WINNING;
import com.amazonaws.ResetException;
import com.amazonaws.event.ProgressEvent;
import com.amazonaws.event.ProgressListener;
import com.amazonaws.services.logs.model.InvalidOperationException;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.event.S3EventNotification;
import com.amazonaws.services.s3.model.*;
import com.amazonaws.services.s3.transfer.TransferManager;
package WINNING;
import com.amazonaws.ResetException;
import com.amazonaws.event.ProgressEvent;
import com.amazonaws.event.ProgressListener;
import com.amazonaws.services.logs.model.InvalidOperationException;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.event.S3EventNotification;
import com.amazonaws.services.s3.model.*;
import com.amazonaws.services.s3.transfer.TransferManager;
@growse
growse / WR01595902
Last active March 20, 2016 23:08
WINE
IT20651 The Society's Sicilian Reserve Red 2012 £7.50 In Stock
2
UPDATE QUANTITY £15.00 DELETE
NZ8721 Greywacke Marlborough Sauvignon Blanc 2015 £14.95 In Stock
2
UPDATE QUANTITY £29.90 DELETE
RH40561 Côtes-du-Rhône, Saint Cosme 2013 £8.95 In Stock
2
#!/usr/bin/env bash
TIME=$((1000000000* `date +%s`))
curl -XPOST http://storebot.growse.com:8086/write?db=main --data-binary $"chrony_systemtimeoffset,host=`hostname` value=`chronyc tracking |grep 'System time'|cut -f 2 -d ':'|sed 's/ *\([0-9\.]*\) seconds \(slow\|fast\) of NTP time/\2\1/g'|sed 's/slow/-/'|sed 's/fast//'` $TIME
chrony_frequency,host=`hostname` value=`chronyc tracking |grep 'Frequency'|cut -f 2 -d ':'|sed 's/ *\([0-9\.]*\) ppm \(slow\|fast\)/\2\1/g'|sed 's/slow/-/'|sed 's/fast//'` $TIME"