Skip to content

Instantly share code, notes, and snippets.

@nicman23
nicman23 / hd-idle-zfs.zsh
Created December 8, 2023 16:21
zfs hdd spindown script
#!/bin/zsh
pool=zdata
devices=$(zpool status -P $pool | grep /dev/ | awk '{print $1}')
intervalinsec=120
while true; do
zpool iostat -HyL zdata $intervalinsec 1 |
grep -q '0 0 0 0' ; res=$?
@darkxst
darkxst / rules.txt
Last active March 13, 2025 10:53 — forked from denniskupec/rules.txt
KiCad DRC rules for JLCPCB, 2 & 4-layer PCB
(version 1)
#Kicad 7
# 2-layer, 1oz copper
(rule "Minimum Trace Width (outer layer)"
(constraint track_width (min 5mil))
(layer outer)
(condition "A.Type == 'track'"))
(rule "Minimum Trace Spacing (outer layer)"
@nephest
nephest / kvm-gpu-passthrough-on-debian-buster.md
Last active January 14, 2025 11:51
Setting up KVM with GPU passthrough in Debian Buster

Here's how to set up a Windows 10 virtual machine in KVM with PCI passthrough. The VM will have access to an NVIDIA graphics card while the host machine (running Debian Buster) uses Intel integrated graphics. This is mostly for my own reference so I don't forget how I did it.

Hardware

  • Intel i5 (an old one) with integrated graphics: this will be used as the graphics card for the host machine running Debian Buster
  • NVIDIA Geforce 1070: this will be used as the graphics card for the Windows 10 VM

Step 1: Enable IOMMU

In order to do hardware passthrough with KVM at all, you need to enable the Intel Vt-d virtualization extensions. Edit /etc/default/grub and edit the GRUB_CMDLINE_LINUX_DEFAULT line so that it reads like:

@denniskupec
denniskupec / rules.txt
Created June 5, 2021 23:17
KiCad DRC rules for JLCPCB, 4-layer PCB
(version 1)
# 4-layer, 1oz copper
(rule "Minimum Trace Width and Spacing (inner layer)"
(constraint track_width (min 5mil))
(constraint clearance (min 5mil))
(layer inner)
(condition "A.Type == 'track'"))
(rule "Minimum Trace Width and Spacing (outer layer)"
@bellbind
bellbind / main-fftw-bench.c
Last active August 6, 2024 11:46
[C11][FFTW] FFT examples
// [compile] cc -O3 -std=c11 -pedantic -Wall -Wextra main-fftw-bench.c -lfftw3 -o main-fftw-bench
#include <complex.h>
#include <stdio.h>
#include <stdlib.h>
#include <fftw3.h>
typedef fftw_complex CN;
void fft(size_t N, CN c[N], CN ret[N]) {
fftw_plan fft = fftw_plan_dft_1d(N, c, ret, FFTW_FORWARD, FFTW_ESTIMATE);
@korylprince
korylprince / merge.py
Last active January 29, 2025 17:27
Modify 10.13 (SFL2) Server Favorites list
#!/usr/local/munki/munki-python
# change the above path to your own python if you don't have Munki installed
"""
Merges add_servers into current favorites and removes remove_servers.
Run as root to update all users or as normal user to update just that user.
"""
import os
import getpass
@bholzer
bholzer / animation_config.py
Last active August 7, 2023 11:19
Blender rendering from the command line.
import sys
import bpy
import addon_utils
argv = sys.argv
argv = argv[argv.index("--") + 1:] # get all args after "--"
C = bpy.context
bpy.context.scene.cycles.device = 'GPU'
cycles_prefs = C.user_preferences.addons['cycles'].preferences
@rowanphipps
rowanphipps / macOS_rEFInd_guide.md
Created August 10, 2017 17:53
A guide to using rEFInd on macOS

A Guide to Multibooting a Mac

Disclaimer: This has the potential to destroy all the data on your drive. Make sure you have adequate (and verified working) backups before you proceed. You have been warned!

That being said this should leave all of your data untouched.

Background:

I have a mid-2012 15” non-Retina Mac book pro with a 1TB hard drive. I decided that I wanted to make my system faster by replacing the hard drive with an ssd and while I was at it I decided I also wanted to have Windows and Ubuntu partitions. Doing it this way meant that I had no data on the SSD while I experimented with partitions and boot managers although everything I did should be possible on a drive with an existing system.

Goals:

  • Multiple OSs installed with the ability to add more
@kristopherjohnson
kristopherjohnson / JSONHttpPost.java
Created July 27, 2012 17:59
Create a JSON POST request for Android
/**
* Create HttpPost request with a JSON string body, expecting a JSON response
*/
private HttpPost createJSONPostRequest(String emailAddress, String data) throws JSONException, UnsupportedEncodingException
{
JSONObject json = new JSONObject();
json.put("protocolVersion", "1.0");
json.put("emailAddress", emailAddress);
json.put("data", data);
String jsonString = json.toString();
@tobin
tobin / extrapolation_demo.m
Created May 31, 2012 14:15
Linear predictive extrapolation
% This code answers the question at http://dsp.stackexchange.com/a/110/64
N = 150; % Order of LPC auto-regressive model
P = 500; % Number of samples in the extrapolated time series
M = 150; % Point at which to start predicting
t = 1:P;
x = 5*sin(t/3.7+.3)+3*sin(t/1.3+.1)+2*sin(t/34.7+.7); %This is the measured signal