Skip to content

Instantly share code, notes, and snippets.

View hradec's full-sized avatar

Hradec hradec

View GitHub Profile
from arnold import *
import GafferArnold
import ctypes
import imath
import Gaffer
def convert_parameters( gaffer_shader, node ):
node_name = AiNodeGetName( node )
entry = AiNodeGetNodeEntry( node )
@brindy
brindy / heic2jpg.swift
Created March 11, 2019 11:57
macOS command line program to convert HEIC images to JPGs
import Foundation
import Cocoa
guard CommandLine.arguments.count > 1 else {
fatalError("Usage: heic2jpg <folder>")
}
let folder = CommandLine.arguments[1]
guard let files = try? FileManager().contentsOfDirectory(atPath: folder) else {
@robv8r
robv8r / docker_tags.sh
Last active November 3, 2023 14:11
List Docker Image Tags using bash
#!/usr/bin/env bash
# Gets all tags for a given docker image.
# Examples:
# retrieve all tags for a single library
# docker-tags "library/redis" | jq --raw-output '.[]'
# retrieve all tags for multiple libraries
@DennisWeidmann
DennisWeidmann / NSImageExtension.swift
Last active January 9, 2023 10:10
Convert NSImage to CVPixelBuffer
extension NSImage {
func pixelBuffer() -> CVPixelBuffer? {
let width = self.size.width
let height = self.size.height
let attrs = [kCVPixelBufferCGImageCompatibilityKey: kCFBooleanTrue,
kCVPixelBufferCGBitmapContextCompatibilityKey: kCFBooleanTrue] as CFDictionary
var pixelBuffer: CVPixelBuffer?
let status = CVPixelBufferCreate(kCFAllocatorDefault,
Int(width),
Int(height),

The banana pi m1 works with the cheap ~$15 chinese 5 port sata multipliers.

Warning: The multipliers will get really hot and unreliable under load or if more than three drives are attached. Definitely put at least a heatsink on it.

With the official bananian distro it appears to work out of the box but it unfortunately only works with one drive at a time.

To get it working with multiple drives you need to enable the sunxi pmp support. The reason this is not enabled per default is that when it is enabled you will be unable to use the sata port without a port multiplier.

The kernel in the official bananian distro does not have sunxi pmp support compiled into it and the kernel is too old anyway.

@omaraflak
omaraflak / main.cpp
Last active March 23, 2024 14:44
Image convolution in C++ + Gaussian blur
#include <iostream>
#include <vector>
#include <assert.h>
#include <cmath>
#include <png++/png.hpp>
using namespace std;
typedef vector<double> Array;
typedef vector<Array> Matrix;
@theherk
theherk / sshuttle.service
Created September 19, 2016 21:57
systemd service unit file for sshuttle
[Unit]
Description=sshuttle service a permanent tunnel
After=network.target
[Service]
ExecStart=/usr/bin/sshuttle -r h4s@localhost:39111 0.0.0.0/0 --dns -D --pidfile=/var/run/sshuttle.pid -e 'ssh -i /home/h4s/.ssh/whtunnel2'
Restart=always
Type=forking
PIDFile=/var/run/sshuttle.pid
@gdamjan
gdamjan / pxe-vm.sh
Last active June 14, 2023 01:53
A script to start a qemu-kvm virtual machine that boots from PXE (it'll configure a bridge and add eth0 to it)
#!/bin/bash
MEM=1024
LAN=eth0
BRIDGE=virtbr
ARCH=x86_64 # i386
#BIOS="-bios OVMF.fd" # to emulate an UEFI netboot
# supported wifi interfaces can be bridged if you set 4addr mode first:
# iw dev $LAN set 4addr on