Skip to content

Instantly share code, notes, and snippets.

View thedaemon's full-sized avatar

Clay Ayers thedaemon

View GitHub Profile
@jsm222
jsm222 / mastodon-freebsd.txt
Last active August 14, 2023 14:58
Mastodon on FreeBSD
Not a script but notes, includes simple rc.d scripts which overrides check_process
pkg install -y ImageMagick7-nox11 ffmpeg postgresql15-server libxml2 libxslt git protobuf node16 pkgconf autoconf bison libyaml readline lzlib libffi gdbm nginx redis postgresql15-server \
postgresql15-contrib py39-certbot libidn2 icu ruby30 sudo ruby30-gems rubygem-bundler gmake
corepack enable
yarn set version classic
pw useradd mastodon -d /usr/local/www/mastodon -m -s /nonexistent
@CoryBloyd
CoryBloyd / SDLblit.cpp
Last active July 20, 2024 23:22
Minimal code to set up a window in SDL and blit from CPU RAM to the window
// This work (SDLblit.cpp, by Cory Bloyd) is free of known copyright restrictions.
// https://creativecommons.org/publicdomain/zero/1.0/
#include <SDL.h>
inline uint32_t argb(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { return (a<<24) | (r << 16) | (g << 8) | (b << 0); }
int main(int argc, char *argv[]) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Rect screenRect = { 0,0,1024,1024 };
@Acry
Acry / C-Code.md
Last active February 28, 2024 20:49
C-Idioms, C-Examples, C-Tutorials, C-Snippets, C-Resources
import bpy
from math import pi, floor
rig = bpy.context.selected_objects[0]
def is_keyframe(ob, frame, data_path, array_index=-1):
if ob is not None and ob.animation_data is not None and ob.animation_data.action is not None:
for fcu in ob.animation_data.action.fcurves:
if fcu.data_path == data_path:
if array_index == -1 or fcu.array_index == array_index:
@pr1ntf
pr1ntf / 9front-yabs.sh
Last active September 5, 2023 21:40
Get 9front (Plan9 fork) booted under FreeBSD bhyve
#!/bin/sh
# Yet Another bhyve Script v0.4
# Use this to try and boot 9front, the Plan9 fork.
# Virtio emulation works better (ported drivers)
# PS/2 Mouse emulation requires updated bhyve(8)
# If you don't have it, patch is uploaded with this Gist
# When partitioning, I have had more success with MBR
# GPT may work for some people
@mikebranstein
mikebranstein / disable-windows-update.ps1
Created September 1, 2016 20:26
Disables Windows Update with PowerShell
# set the Windows Update service to "disabled"
sc.exe config wuauserv start=disabled
# display the status of the service
sc.exe query wuauserv
# stop the service, in case it is running
sc.exe stop wuauserv
# display the status again, because we're paranoid
@bkaradzic
bkaradzic / orthodoxc++.md
Last active July 19, 2024 23:17
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@lubosz
lubosz / weather.sh
Created April 14, 2015 19:11
display a weather gif in terminal
#!/bin/sh
DOWNLOAD_DIR=~/Downloads/weather
REGION=txgulf
# make download dir if not available
if [ ! -d "$DOWNLOAD_DIR" ]; then
mkdir -p $DOWNLOAD_DIR
fi
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs