Skip to content

Instantly share code, notes, and snippets.

@bakks
bakks / chart.sh
Created March 8, 2023 19:51
Script to generate a chart using butterfish and python
#!/bin/bash
# This script receives a prompt as an argument, the prompt describes a dataset and a chart output to. This script does the folliwng steps:
# 1. Generate a CSV file of data for the chart using butterfish CLI
# 2. Generate a Python script that uses matplotlib to generate the chart using the input CSV using Butterfish CLI
# 3. Run the Python script to generate the chart
prompt=("$@")
echo "Prompt: $prompt"
@bakks
bakks / create_netns.sh
Last active August 29, 2015 14:27
GCP MAC Spoofing
#!/bin/bash
# This script defines a Linux network namespace with a given MAC address. For example:
# ./create_ns.sh mynamespace 00:00:00:00:00:01 192.168.0.10
# This creates the namespace. Once it exists you can run:
# ip netns exec mynamespace /usr/bin/myservice
# The service will see the given MAC at eth0 and will be accessible at the IP you give (192.168.0.10 in the example).
# This seems to work well on GCP machines, untested elsewhere.
set -e
set -x
@bakks
bakks / sizes.sql
Created January 30, 2015 02:57
Show MySQL data sizes
SELECT table_schema "Data Base Name",
SUM(data_length ) / 1024 / 1024 / 1024 "Data GB" ,
SUM(index_length) / 1024 / 1024 / 1024 "Index GB" ,
sum(data_free ) / 1024 / 1024 / 1024 "Free GB",
SUM( data_length + index_length) / 1024 / 1024 / 1024 "Full Data size in GB"
FROM information_schema.TABLES
GROUP BY table_schema;
#!/bin/bash
#
# esdiagdump
#
# Usage: esdiagdump [-h <hostname/IP>:<port>] [-o <output filename>]
# hostname defaults to localhost
# output file defaults to current directory/esdiagdump.out.<timestamp>
#
# TODO:
# - Support for collecting marvel indices for export
@bakks
bakks / README.md
Last active August 29, 2015 13:57
Interesting Crunchbase Queries
@bakks
bakks / README.md
Last active April 23, 2022 14:35
Global Submarine Cables Block
@bakks
bakks / chart.js
Last active December 17, 2015 14:59
Chart generated at Commonwealth.io
{
query : {
db : 'bakks',
coll : 'submarine_cables',
param : {query : {}, fields: {name:1, path:1, length:1}}
},
css : {
height : 460,
width : 780
},