Skip to content

Instantly share code, notes, and snippets.

@Tianjie-Wu
Tianjie-Wu / float_to_rgba.py
Created September 5, 2023 02:00 — forked from DavidAntliff/float_to_rgba.py
Encode 32bit float into three 8bit RGBA channels
#!/usr/bin/env python
# Store 32-bit floating point number within three 8bit channels of a 32-bit RGBA pixel.
# Only suitable for normalised input values in the range [0.0, 1.0).
#
# Refer: https://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
import numpy as np
def frac(x):
return x - np.floor(x)
@Tianjie-Wu
Tianjie-Wu / fail2ban_amznlnx2.sh
Created August 30, 2023 09:23 — forked from johnstanfield/fail2ban_amznlnx2.sh
install fail2ban on amazon linux 2
# run as root or sudo everything below
# install epel
amazon-linux-extras install epel -y
# install fail2ban
yum -y install fail2ban
# configure fail2ban (just adding enabled=true in the sshd section)
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
#!/bin/bash
#Whenever you clone a repo, you do not clone all of its branches by default.
#If you wish to do so, use the following script:
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
git branch --track ${branch#remotes/origin/} $branch
done