Skip to content

Instantly share code, notes, and snippets.

View hradec's full-sized avatar

Hradec hradec

View GitHub Profile
@hradec
hradec / tar-progress.md
Created September 2, 2023 03:05 — forked from Kautenja/tar-progress.md
one-liners for using tar with gzip and pv for a progress bar

Compress

tar cf - <files> -P | pv -s $(du -sb <files> | awk '{print $1}') | gzip > <some .tar.gz file>

where:

  • `` is the root-mounted (i.e. starts with /) path to the files
from arnold import *
import GafferArnold
import ctypes
import imath
import Gaffer
def convert_parameters( gaffer_shader, node ):
node_name = AiNodeGetName( node )
entry = AiNodeGetNodeEntry( node )
@hradec
hradec / gcloud-port-forward.md
Created August 19, 2021 22:54 — forked from jibs/gcloud-port-forward.md
port forwarding with a google cloud instance

Google cloud's ssh command lets you pass standard ssh flags. To, for example, forward local port 8088 to port 8088 on a vm instance, all you need to do is:

gcloud compute  ssh --ssh-flag="-L 8088:localhost:8088"  --zone "us-central1-b" "example_instance_name"

Now browsing to localhost:8088 works as it would with standard ssh.

@hradec
hradec / gl_ffmpeg.cpp
Last active August 16, 2022 12:03 — forked from rcolinray/gl_ffmpeg.cpp
OpenGL-FFMpeg integration
/*
based on github gist from rcolinray: https://gist.github.com/rcolinray/7552384
you need to build with glfw2, not glfw3.
adjusted for newer ffmpeg ( version>55 - avcodec_alloc_frame now is
av_frame_alloc, and some other defines have AV_ prefix added to it )
build it using something like:
g++ ./gl_ffmpeg.cpp \
-lavcodec -lavutil \
@hradec
hradec / gitclean.sh
Created March 28, 2021 00:10 — forked from Zibri/gitclean.sh
Bash script to remove all revisions from github or gist repository.
#!/bin/bash
#
# By Zibri (2019)
#
# Usage: gitclean username password giturl
#
gitclean ()
{
odir=$PWD;
if [ "$#" -ne 3 ]; then
#!/usr/bin/python
import struct, socket, sys
# network block device server, substitute for nbd-server. Probably slower.
# But it works! And it's probably a lot easier to improve the
# performance of this Python version than of the C version. This
# Python version is 14% of the size and perhaps 20% of the features of
# the C version. Hmm, that's not so great after all...
# Working:
# - nbd protocol
# - read/write serving up files
@hradec
hradec / sshuttle.service
Last active July 11, 2019 17:44 — forked from theherk/sshuttle.service
systemd service unit file for sshuttle
[Unit]
Description=sshuttle service a permanent tunnel
After=network.target
[Service]
ExecStart=/usr/bin/sshuttle -r <user@address:port> --no-latency-control --disable-ipv6 -H --dns -v 192.168.0.0/24
Restart=always
[Install]
WantedBy=multi-user.target

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.