Skip to content

Instantly share code, notes, and snippets.

View Jammyjamjamman's full-sized avatar
👻

James Sherratt Jammyjamjamman

👻
  • Alpha Centauri
View GitHub Profile
@Jammyjamjamman
Jammyjamjamman / .bash
Created June 30, 2019 22:19
some tests...
$RMW_TEST_CMD_STRING --verbose $HOME/somefiles
test_result $?
echo " == Should not work if '-f' isn't used"
output=`echo "y" | $RMW_ALT_TEST_CMD_STRING --purge -e`
test "$output" = "purge has been skipped: use -f or --force"
test_result $?
echo " == Should not work if '--purge' isn't used"
output=`echo "y" | $RMW_TEST_CMD_STRING -ffe`
@Jammyjamjamman
Jammyjamjamman / .rs
Created July 28, 2019 01:07
infer type
struct Item {
name: String,
weight: String,
mass: u64,
}
fn main() {
println!("Hello, world!");
@Jammyjamjamman
Jammyjamjamman / .jl
Last active July 31, 2019 09:07
v important code
# ʇʇɐɹɹǝɥS sǝɯɐſ :ɹoɥʇn∀
# 3ʌ ˥Ԁƃ :ǝsuǝɔı˥
pr̢̛͊͑̏̃̓̒̽͠i̧҉ń̛́̌ͣͭ̌ͨ̂̑͊̉ͥ͂͌͘͡t̵̋͂̍̋ͣ̂͂ͮ̏̒̍̓͋͑́̕l̶nͮͦͧ͛̑ͯ͛ͣ🐬 = println
≡ = ==
🍖 = 0
😹 = 1
👀 = 2
🖕 = zeros
import os
import shutil
def fix_files(folder):
print("Fixing filenames and paths...")
files = os.listdir(folder)
for f in files:
src = os.path.join(folder, f)
@Jammyjamjamman
Jammyjamjamman / list_installed_vcpkgs.ps1
Created June 5, 2021 19:29
Get list of installed vcpkgs. Output can be passed to "vcpkg install ..."
# Creates a space-separated list of packages installed in your vcpkg instance.
# Expects to be executed in the same dir as your vcpkg.exe.
$packages_list = ""
# Used to exclude packages with square brackets, because they're a subpackage of another package.
# Also only select x64-windows-static installed packages.
$packages_select_string = "[^\]]:x64-windows-static"
.\vcpkg.exe list | Select-String $packages_select_string | ForEach-Object -Process {
$packages_list += ($_ -split ' ')[0] + ' '
}
@Jammyjamjamman
Jammyjamjamman / RCAndRefCell.rs
Last active May 13, 2022 21:40
Playing with rust reference counting
// import commonly used items from the prelude:
// use rand::prelude::*;
use std::{ rc::Rc, cell::RefCell };
fn destroy<T>(_: T) {
}
fn main() {
let val = Rc::new(5);
@Jammyjamjamman
Jammyjamjamman / MakeMGAppImage.sh
Created March 1, 2022 23:14
Slightly broken script for making MegaGlest Appimage
#!/bin/bash
# . /etc/os-release
# if [[ $ID != "ubuntu" || $VERSION_ID != "18.04" ]];
# then
# echo "Ubuntu 18.04 is required! System found: $ID $VERSION_ID"
# fi;
AppImageMG="AppImageMG"
rm -rf $AppImageMG
mkdir $AppImageMG
@Jammyjamjamman
Jammyjamjamman / get_foldersizes.ps1
Last active May 7, 2022 20:37
Basic powershell script to get folder sizes in current dir (depth 1).
Get-ChildItem -Directory | ForEach-Object {
echo "Folder: $($_.Name)"
echo "Size: $((Get-ChildItem $_.Name -Recurse | Measure-Object -Property Length -Sum).Sum/(1024*1024*1024))GiB"
echo ""
}
@Jammyjamjamman
Jammyjamjamman / bash_stuff.sh
Last active January 8, 2023 21:33
bash_stuff.sh
#!/bin/sh
# Credits to Andy5995 for finding many (currently all) of these commands.
# commands for indenting C code with 2 spaces
indent -ci2 -bl -bli0 -nut -npcs *.c *.h
# If you make a script from this command...
indent -ci2 -bl -bli0 -nut -npcs $1 $2
# build with openssl
@Jammyjamjamman
Jammyjamjamman / gh-actions-configuring.yml
Created May 13, 2022 21:34
some snippets for github actions
# Cancel workflow if new workflow in same group is in progress.
# https://docs.github.com/en/enterprise-cloud@latest/actions/using-jobs/using-concurrency
name: Build
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
# allow only certain types of pull_request.
pull_request:
types: [ opened, reopened, synchronize ]