Skip to content

Instantly share code, notes, and snippets.

@yellowcrescent
yellowcrescent / heat-example.yaml
Created July 22, 2023 03:44
Openstack Heat example
# Heat example with Glance images
#
# Example using Openstack CLI:
#
# openstack stack create -t heat-example.yaml \
# --parameter service_project=$SERVICE_PROJECT_UUID \
# --parameter image_base_url=$MY_BASE_URL \
# example-base-images
#
# * `$SERVICE_PROJECT_UUID` - Openstack UUID of the `service` project to own the public images
@yellowcrescent
yellowcrescent / xpkg.sh
Created April 14, 2021 04:26
Extracting MacOS pkg files on Linux
#!/bin/bash
#
# Super basic MacOS .pkg file extractor using p7zip & cpio
# @yellowcrescent
#
# Usage: xpkg.sh MyPkg.pkg /path/to/output/dir
#
ZBIN=7z
PLFILE="Payload~"
@yellowcrescent
yellowcrescent / capture.sh
Created August 11, 2019 21:47
magewell capture
#!/bin/bash
VDEV="/dev/video0"
ADEV="default:CARD=HDMI"
# input: cvbs (composite), yc (s-video), hdmi, component, auto
VINPUT=yc
AINPUT=line_in
# Set input to S-Video and AR to 4:3
mwcap-control --audio-input $AINPUT $VDEV
@yellowcrescent
yellowcrescent / decrypt.sh
Last active April 22, 2019 01:30
decrypt and open aesgcm URLs
#!/bin/bash
INAES="$1"
URL=$(echo $1 | sed 's/aesgcm:/https:/')
KEY=$(echo $1 | awk -F\# '{print $2}')
EXT=$(echo $1 | awk -F\# '{print $1}' | awk -F. '{print $NF}')
TMPFILE=$(tempfile).${EXT}
echo "Decrypting to $TMPFILE ..."
curl -s "${URL}" | ./aesgcm ${KEY} > ${TMPFILE}
@yellowcrescent
yellowcrescent / cert_update.py
Created December 16, 2018 21:53
adding CA-trusted certificate for FreeIPA
## Automatic method ###
# See: <https://www.freeipa.org/page/Using_3rd_part_certificates_for_HTTP/LDAP>
# Add the root and CA certificates, if not already added. If this is not done, your external cert will NOT be trusted
ipa-cacert-manage -n addtrust_root -t C,, install AddTrustExternalCARoot.crt
ipa-cacert-manage -n comodoca_top -t C,, install COMODORSAAddTrustCA.crt
ipa-cacert-manage -n comodoca_dcv -t C,, install COMODORSADomainValidationSecureServerCA.crt
ipa-certupdate
# Install/update the certificate
@yellowcrescent
yellowcrescent / k8s-coreos-setup.md
Last active December 17, 2018 21:32
CoreOS Kubernetes cluster setup at Digitalocean

Notes on setting up a Kubernetes cluster on CoreOS (stable) with DigitalOcean's platform.

Partially stolen from this guide by kevashcraft

Spin up VMs

  • Spin up 4 VMs with CoreOS Stable. One will be the master, the other 3 will be workers
  • Tag them with k8s:master and k8s:worker respectively, along with a tag for the cluster
  • Droplets can be created via your DO control panel, or by using doctl. Just change the CLUSTER_NAME, CLUSTER_DOMAIN, and SSHKEY_ID values below to match your own, then save the file to cluster_create.sh, chmod +x cluster_create.sh, then run it ./cluster_create.sh. If you don't already have doctl setup, it will probably be easier to just do this from the DO control panel if you only need to do a one-time setup for development.
@yellowcrescent
yellowcrescent / pdnsadmin.diff
Created September 20, 2018 19:08
PowerDNS-Admin changes
diff --git a/app/models.py b/app/models.py
index 9a116b8..503a0f7 100644
--- a/app/models.py
+++ b/app/models.py
@@ -1015,6 +1015,7 @@ class Record(object):
records.append(new_srr)
logging.info("%s new SOA serial --> %s", domain_dot, newser)
else:
+ newser = None
logging.error("Failed to retrieve SOA record for domain")
@yellowcrescent
yellowcrescent / lcd_clock.v
Created June 2, 2018 20:05
lcd blinky example in verilog
`timescale 1ps / 1ps
module lcd_clock (
input wire clk,
input wire rst,
output reg pulse
);
parameter clk_freq = 26'd12000000; // X1 = 12MHz
@yellowcrescent
yellowcrescent / amazon_total.py
Last active June 20, 2018 17:58
Calculate total Amazon spending from Order Report
#!/usr/bin/env python
# vim: set ts=4 sw=4 expandtab:
"""
amazon_total.py
Calculate total cost of Amazon orders
Usage:
- Login to your Amazon account, then click on 'Download order reports'
Choose the time period, and Amazon will generate a CSV file for you.
@yellowcrescent
yellowcrescent / nginx_sockuser.diff
Last active April 4, 2019 23:12
add sock_user, sock_group, sock_perm options to nginx listen directive
diff -r 72d3aefc2993 src/core/ngx_connection.c
--- a/src/core/ngx_connection.c Wed Jul 26 13:13:51 2017 +0300
+++ b/src/core/ngx_connection.c Fri Jul 28 22:39:23 2017 -0400
@@ -87,6 +87,12 @@
ls->fastopen = -1;
#endif
+#if (NGX_HAVE_UNIX_DOMAIN)
+ ls->sock_user = -1;
+ ls->sock_group = -1;