Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
OPTS=""
OPTS="$OPTS -nodefaults"
OPTS="$OPTS -enable-kvm"
OPTS="$OPTS -cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time"
OPTS="$OPTS -smp 4"
OPTS="$OPTS -m 4G"
OPTS="$OPTS -usb -device usb-tablet"
#!/bin/sh -e
# Works on Debian Sid as of March 2021, YMMV :)
# Worth reading:
# man qemu-system
# less /usr/share/doc/ovmf/README.Debian
# https://wiki.debian.org/SecureBoot/VirtualMachine
# https://wiki.qemu.org/Documentation/Networking
# https://github.com/qemu/qemu/blob/master/docs/pcie.txt
@i3v
i3v / cdm_fio.sh
Last active February 5, 2024 22:33
Reproducing CrystalDiskMark tests with fio - fixes for https://unix.stackexchange.com/revisions/480191/9
#!/bin/bash
# This script is based on https://unix.stackexchange.com/revisions/480191/9 .
# The following changes proved to be necessary to make it work on CentOS 7:
# * removed disk info (model, size) - not very useful, might not work in many cases.
# * using "bw" instead of "bw_bytes" to support fio version 3.1 (those availible through yum @base)
# * escaping exclamation mark in sed command
# * the ".fiomark.txt" is not auto-removed
LOOPS=5 #How many times to run each test
@eduardobaitello
eduardobaitello / istio_egress_amazon_s3.yaml
Created October 24, 2018 18:11
Create Istio resources to allow containers access external s3 buckets
# https://istio.io/docs/tasks/traffic-management/egress/#configuring-istio-external-services
# In this example the bucket is in the us-east-1 region
# Make sure to match the host with the endpoint of your region: https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: egress-amazon-s3
spec:
hosts:
- my-bucket-name.s3.amazonaws.com
@montanaflynn
montanaflynn / concurrency.go
Last active October 26, 2023 13:35
A simple example of bounded concurrency and wait groups in Golang
package main
import (
"fmt"
"sync"
"time"
)
func main() {
@stebennett
stebennett / feeds.opml
Created August 12, 2016 15:24
The feeds I currently subscribe to.
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Stephen subscriptions in feedly Cloud</title>
</head>
<body>
<outline text="Companies" title="Companies">
<outline type="rss" text="Trello" title="Trello" xmlUrl="https://trello.engineering/feed.xml" htmlUrl="http://tech.trello.com/"/>
<outline type="rss" text="IMVU" title="IMVU" xmlUrl="http://engineering.imvu.com/feed/" htmlUrl="https://engineering.imvu.com"/>
@major
major / ca.py
Last active March 15, 2024 14:24
Making a certificate authority (CA) with python cryptography
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.x509.oid import NameOID
import datetime
import uuid
one_day = datetime.timedelta(1, 0, 0)
private_key = rsa.generate_private_key(
public_exponent=65537,
@dbfin
dbfin / set_default_kernel.sh
Last active August 21, 2022 14:18
Sets default kernel and modifies update policy
#!/bin/bash --
# requires bash 4.0+
### FUNCTIONS
# usage: error_exit message
function error_exit() {
echo -e "\e[31m$1\e[0m"
exit 1
}
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 7, 2024 09:51
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'