Skip to content

Instantly share code, notes, and snippets.

@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@citruz
citruz / QEMU_ON_M1.md
Last active June 6, 2024 08:29
Create Ubuntu and Windows VMs with QEMU on Apple Silicon

Running Linux and Windows on M1 with QEMU

30.11.2020: Updated with the new patchseries and instructions for Windows

02.12.2020: Added tweaks

08.12.2020: Updated with patchseries v4

31.01.2020: Updated with patchseries v6

@wrighter
wrighter / download_bars.py
Last active May 22, 2024 07:28
A command line utility to download historical data from Interactive Brokers
#!/usr/bin/env python
import os
import sys
import argparse
import logging
from datetime import datetime, timedelta
from typing import List, Optional
from collections import defaultdict
---
apiVersion: v1
kind: PersistentVolume
metadata:
# Can be anything, but has to be matched at line 47
# Also should avoid conflicts with existing PV names in the namespace
name: preprov-pv-cephfs-01
spec:
accessModes:
- ReadWriteMany
@swlaschin
swlaschin / FsCsInterop.md
Last active May 26, 2024 03:50
F# to C# interop tips

Tips on exposing F# to C#

Api and Methods

I suggest that you create one or more Api.fs files to expose F# code in a C# friendly way.

In this file:

  • Define functions with PascalCase names. They will appear to C# as static methods.
  • Functions should use tuple-style declarations (like C#) rather than F#-style params with spaces.
if sysbench.cmdline.command == nil then
error("Command is required. Supported commands: run")
end
sysbench.cmdline.options = {
point_selects = {"Number of point SELECT queries to run", 5},
skip_trx = {"Do not use BEGIN/COMMIT; Use global auto_commit value", false}
}
local page_types = { "actor", "character", "movie" }
@fdegir
fdegir / fio.sh
Created February 16, 2018 10:39
fio
#!/bin/bash
RESULT_FILE=/tmp/result_$$
rm -rf $HOME/tmp-fio
mkdir -p $HOME/tmp-fio && cd $HOME/tmp-fio
echo "Starting storage tests"
echo "Results will be saved in $RESULT_FILE"
@niucool
niucool / alpha-vantage-live.py
Last active October 17, 2017 17:52
zipline-live
import pandas as pd
#https://github.com/RomelTorres/alpha_vantage
from alpha_vantage.timeseries import TimeSeries
ALPHA_VANTAGE_KEY = 'XXXXXXXXXXXX'
##################################
# Alpha vantage version of data.history and data.current
def av_data_history(assets, fields, bar_count, frequency):
ts = TimeSeries(key=ALPHA_VANTAGE_KEY, output_format='pandas')
@Luzifer
Luzifer / README.md
Last active May 29, 2024 08:02
Running docker-compose as a systemd service

Running docker-compose as a systemd service

Files

File Purpose
/etc/compose/docker-compose.yml Compose file describing what to deploy
/etc/systemd/system/docker-compose-reload.service Executing unit to trigger reload on docker-compose.service
/etc/systemd/system/docker-compose-reload.timer Timer unit to plan the reloads
/etc/systemd/system/docker-compose.service Service unit to start and manage docker compose
@Vince-Cercury
Vince-Cercury / gist:43c7afc1a6b0f580b0cb6fb27e650042
Created September 1, 2017 00:12
How to monitor an external secure etcd cluster with Prometheus Operator
# How to monitor a secure external etcd service with Prometheus Operator
This guide will help you monitor an external etcd cluster. When the etcd is not hosted inside Kubernetes.
This is often the case with the Kubernetes setup. This has been tested with kube-aws but same principals will apply to other tools.
# Step 1 - Make the etcd certificates available to Prometheus pod
Prometheus Operator (and Prometheus) allow us to specify a tlsConfig. This is required as most likely your etcd metrics end points is secure.
## a - Create the secrets in the namespace
Prometheus Operator allows us to mount secrets in the pod. By loading the secrets as files, they can be made available inside the Prometheus pod.