Skip to content

Instantly share code, notes, and snippets.

View rigred's full-sized avatar

Rigo rigred

View GitHub Profile
@rigred
rigred / Seagate ST2000DL001 F3 commands
Created May 27, 2017 15:50
Dump of the F3 commands for the ST2000DL001 Seagate Drive CC97 FW
Rst 0x20M
(P) SATA Reset
ASCII Diag mode
F3 T>
ASCII Diag mode
F3 T>/C
@rigred
rigred / easy-secure-iptables
Last active June 28, 2023 01:12
A Simple script to lock down your ubuntu/other server using iptables firewall. This script makes use of outbound rules so be sure to configure any services you need access to. Also setup your preferred ssh port.
#!/bin/bash
IPT="/sbin/iptables"
# Server IP
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER="8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220"
# Allow connections to this package servers
@rigred
rigred / PCI-e_bus_bandwidth_calc.md
Last active June 15, 2023 13:10
PCI-e bus bandwidth calculation

How PCI-e bandwidth and actual true data bandwidth can be calculated.

PCI-e 1.x uses an 8/10b encoding scheme, so to send 8 bits of data, 10 bits of encoded data must be transfered. 2 of those bits are there as error checking and correction bits to account for interference which is very common on fast buses. SATA btw also uses 8b/10b encoding, you loose 20% of bandwidth (1-8/10) to get the data across.

PCI-e 1.0 is clocked at 2.5Ghz, it sends 1 bit per clock cycle and each lane corresponds to a 1 bit bi-directional serial channel. Which is kind of neat since here 'Gigatransfers' indicate 1 bit transfered for every clock cycle. This should immediately tell us that unlike FSB which transfers multiple bts per cycle in a parallel fashion, PCI-e is serial, since we are sequentially throwing 1 bit of data per cycle onto the bus and it takes multiple cycles to send a full byte. While on a parallel bus multiple bytes can be sent per cycle.

@rigred
rigred / rocm_5.0_matrix.md
Created February 18, 2022 20:13
ROCM 5.0 AMD GPU feature matrix
cap gfx000 gfx803 gfx900 gfx906 gfx908 gfx90a gfx1010 gfx1011 gfx1012 gfx1030
HasMFMA_bf16_1k 0 0 0 0 0 1 0 0 0 0
HasAddLshl 0 0 1 1 1 1 1 1 1 1
HasAtomicAdd 0 0 0 0 1 1 0 0 0 0
HasCodeObjectV3 0 1 1 1 1 1 1 1 1 1
HasDirectToLds 0 1 1 1 1 1 1 1 1 1
HasExplicitCO 0 0 1 1 1 1 1 1 1 1
HasExplicitNC 0 0 0 0 0 0 1 1
@rigred
rigred / ASRock_Z370-Pro4
Last active November 6, 2021 13:57
Preliminary Config for ASRock Z370 Pro4 (NCT6833)
# Note this is an early (INCOMPLETE) testing config
chip "nct6683-isa-0a20"
# Fans
label fan1 "Chassis Fan 1 Speed"
label fan2 "CPU Fan 1 Speed"
label fan3 "CPU Fan 2 Speed"
label fan4 "Chassis Fan 2 Speed"
# Fan minimums (conservative 400rpm)
@rigred
rigred / README.md
Last active January 22, 2021 10:35
Script to set date/time of macbook without a battery

Copy the launch daemon file named com.startup.script.plist in /Library/LaunchDaemons. Then set the permissions for it

sudo chmod +x /Library/LaunchDaemons/com.startup.script.plist
sudo chown root:wheel /Library/LaunchDaemons/com.startup.script.plist

Next copy the shell script updatetime.sh in /usr/local/bin/. Make it executable with sudo chmod +x /usr/local/bin/updatetime.sh and owned by root:wheel with sudo chown root:wheel /usr/local/bin/updatetime.sh.

Enable and launch the Daemon with:

@rigred
rigred / get_playtime.js
Created June 5, 2020 11:38
Get playtime of a youtube playlist
var list = document.getElementsByClassName('ytd-thumbnail-overlay-time-status-renderer');
var time = 0;
function toS(hms) {
var a = hms.split(':');
while (a.length < 3) {
a.unshift(0);
}
var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);
return seconds;
Doing md4 for 3s on 16 size blocks: 21912727 md4's in 3.00s
Doing md4 for 3s on 64 size blocks: 16415248 md4's in 3.00s
Doing md4 for 3s on 256 size blocks: 9205399 md4's in 3.00s
Doing md4 for 3s on 1024 size blocks: 3410651 md4's in 3.00s
Doing md4 for 3s on 8192 size blocks: 489747 md4's in 3.00s
Doing md4 for 3s on 16384 size blocks: 248924 md4's in 3.00s
Doing md5 for 3s on 16 size blocks: 28673396 md5's in 3.00s
Doing md5 for 3s on 64 size blocks: 16591487 md5's in 3.00s
Doing md5 for 3s on 256 size blocks: 7269859 md5's in 3.00s
Doing md5 for 3s on 1024 size blocks: 2244337 md5's in 3.00s
@rigred
rigred / my.na_filter.txt
Last active February 19, 2020 19:53
Ublock filter to remove my.na login modal from namibian news sites.
www.republikein.com.na###payModal
www.republikein.com.na##.in.fade.modal-backdrop
www.republikein.com.na###pre_load
www.republikein.com.na##script:contains(function run_validate_access(){)
www.az.com.na###payModal
www.az.com.na##.in.fade.modal-backdrop
www.az.com.na###pre_load
www.az.com.na##script:contains(function run_validate_access(){)
@rigred
rigred / PKGBUILD rocminfo
Created August 20, 2019 10:36
PKGBUILD for rocminfo 2.7.0
# Maintainer: Jakub Okoński <jakub@okonski.org>
# Maintainer: Rigo Reddig <rigo.reddig@gmail.com>
pkgname=rocminfo
pkgver=2.7.0
pkgrel=1
pkgdesc="ROCm info tools - rocm_agent_enumerator"
arch=(x86_64)
url="https://github.com/RadeonOpenCompute/rocminfo"
license=('NCSA')
makedepends=(git cmake ninja)