Skip to content

Instantly share code, notes, and snippets.

@thulio
thulio / gcccpuopt.sh
Created July 24, 2012 12:21
Get GCC optimal compile flags
#!/bin/sh
# Print the gcc cpu specific options tailored for the current CPU
# Author:
# http://www.pixelbeat.org/
# Notes:
# This script currently supports Linux,FreeBSD,Cygwin
# This script is x86 (32 bit) specific
# It should work on any gcc >= 2.95 at least
@tommybutler
tommybutler / smartcheck.sh
Last active December 29, 2023 11:52
Script to quickly scan the S.M.A.R.T. health status of all your hard drive devices in Linux (at least all the ones from /dev/sda to /dev/sdzz). You need smartctl installed on your system for this script to work, and your hard drives need to have S.M.A.R.T. capabilities (they probably do).
#!/bin/bash
# install the smartctl package first! (apt-get install smartctl)
if sudo true
then
true
else
echo 'Root privileges required'
@bantu
bantu / 00-status.md
Last active February 16, 2024 12:16
Seagate BlackArmor 4XX (e.g. 400, 420, 440) NAS

Device Status

  • A serial cable was soldered onto the board's CN4 connector which can be used for debugging.
  • A USB drive is attached containing a debootstrapped Debian Jessie armel on an ext4 filesystem.
  • The original flash was completely erased.
  • A new version of u-boot provided by Evgeni was installed onto the flash.
  • The new u-boot version is capable of loading files from ext4 filesystems, the old one was not.
  • u-boot loads three files: /boot/uInitrd, /boot/uDtb, /boot/uImage
  • The kernel is provided by the linux-image-kirkwood debian package.
@rstanleyhum
rstanleyhum / restic-windows-vss.ps1
Last active January 13, 2023 21:55
Restic Backup Windows Volume Shadow Copy Service script taken from https://github.com/restic/restic/issues/340
# Windows PowerShell Script to use restic to backup files using the Volume Shadow Copy Service, allowing
# that are in use to be backed up. The script must be run with elevated privileges.
# The Volume Shadow Copy Service must be enabled for the disk volume that contains the files to be backed up.
#
# Parameters
$resticExe = 'C:\Users\Username\go\bin\restic.exe'
$resticRepository = '\\SYNOLOGY212J\backups\restic-workstation'
$rootVolume = "C:\"
# List of folders to backup, separated by commas
$foldersToBackup = @(
@Juul
Juul / lte_mbim_from_scratch.md
Last active May 6, 2024 15:17
How to use 4G LTE modems like the MC7455 on both Debian/Ubuntu and OpenWRT using MBIM

The purpose of this document is to get you familiar with the concepts and command line tools involved with connecting to the internet using modern 4G LTE modems on both Debian/Ubuntu and OpenWRT.

This writeup is based on my experiences with the Sierra Wireless AirPrime MC7455 modem and a Calyx (Sprint) SIM card, but it should apply to most modern 4G LTE modems.

High level overview

These are the steps required:

  • Physically connect antennas
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
uint32_t decompress_osdsys(uint8_t *src, uint8_t *dst)
{
uint32_t run = 0;
@balika011
balika011 / PSX_rel.cpp
Last active April 29, 2024 09:25
This tool can be used to decrypt PSX package binaries, like main.rel. (You need to bring your own key!)
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <openssl/aes.h>
#include <openssl/rsa.h>
#include <algorithm>
#include <openssl/sha.h>
#pragma pack(push, 1)
struct npCoreKey
@rbreaves
rbreaves / WaylandUbuntu19.10-AppTitle
Last active February 7, 2024 12:02
Grab wmclass name or Window Name/Title under Wayland with Gnome 3.x
# Single Command, runs 2 calls to gdbus to get the currently active Window from Gnome 3.x
# Escaped so you can copy and paste into terminal directly
gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval global.get_window_actors\(\)[`gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval global.get_window_actors\(\).findIndex\(a\=\>a.meta_window.has_focus\(\)===true\) | cut -d"'" -f 2`].get_meta_window\(\).get_wm_class\(\) | cut -d'"' -f 2
# Unescaped version, will not run
# Broken down into 2 commands.
# Call to Gnome to get the array location of the active Application
gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m \
@lukas2511
lukas2511 / meraki-init.sh
Last active April 15, 2024 11:34
Meraki MS220-8P config without cloud bullshit
#!/bin/sh
# This script configures a meraki ms220-8p switch completely from scratch
# See https://leo.leung.xyz/wiki/Meraki_MS220-8P for rooting instructions
# You can keep config and config.local completely empty, but i'd recommend to add a configuration
# which isolates all ports from each other.
# Without that you might have switching loops on bootup (unlikely since STP keeps longer to initialize
# than it takes this script to take over, but it just feels cleaner).

OSDSYS image resource image information

The information in this documentation does not apply to the early Protokernel consoles which has a very different OSDSYS program.

The images stored in the ROM are in a compressed format, so decompress before use. The following is the implementation of the decompression routine: https://gist.github.com/uyjulian/14388e84b008a6433aa805f5d0436c87

The images stored in the ROM are raw image formats with no information attached, so the following table describes the extra information required to display the image.

| Filename | Size | Offset | Image format |