Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
set -euo pipefail
MIRRORLIST_FILE="/etc/pacman.d/mirrorlist"
MIRRORLIST_URL="https://archlinux.org/mirrorlist/?country=CA&country=US&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on"
cp $MIRRORLIST_FILE{,.bak}
curl "$MIRRORLIST_URL" | sed 's/#Server/Server/g' > $MIRRORLIST_FILE
@Eggbertx
Eggbertx / sphere1-api.d.ts
Created June 29, 2021 21:38
Sphere 1.x type definitions file
/**
* Sphere 1.x API declaration
* Copyright (c) 2019-2021, Eggbertx
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
@Eggbertx
Eggbertx / sphere2-api.d.ts
Last active August 21, 2023 19:04
Sphere 2.x type definitions file
/**
* Cell, the Sphere packaging compiler
* Copyright (c) 2015-2021, Fat Cerberus (with some modifications by Eggbertx)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
@Eggbertx
Eggbertx / personlib-es6.js
Created October 27, 2020 21:15
A semi-rewrite of my personlib script for miniSphere with more ES6 emphasis
/*
* PersonLib 2.0.2020-10-27
* Copyright (c) 2016-2020, Eggbertx
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1 Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
@Eggbertx
Eggbertx / vectorlib.js
Last active June 20, 2020 01:07
An ES6 JavaScript class for handling vector algebra in two or three dimensions
/**
* A class for handling vector algebra in two or three dimensions
* If you only need a two-dimensional vector, you can just ignore
* the z property and all z parameters, since they aren't required
*
* See https://en.wikipedia.org/wiki/Euclidean_vector
*/
export class Vector {
/**
* Constructs a Vector object
@Eggbertx
Eggbertx / embedfilesc.sh
Last active May 26, 2019 21:50
A shell script that uses ld/xxd to pack files into an object file or header file to be used by C programs
#!/bin/sh
set -euo pipefail
function usage {
echo "usage: $0 [-o outfile] [-m text|binary] [-i] file..."
echo "options:"
echo " -h show usage info"
echo " -i use xxd (usually comes with vim) to generate a C-style"
echo " include header rather than an object file (overrides -m)"
@Eggbertx
Eggbertx / joytest.js
Created December 16, 2018 21:30
miniSphere Joystick API Test
/*
* miniSphere Joystick API Test
* (c) 2018 Eggbertx
*/
import { Thread } from 'sphere-runtime';
export default class Game extends Thread {
constructor() {
super();
@Eggbertx
Eggbertx / makepostform.go
Last active September 23, 2018 16:17
makePostForm is a convenient function for easily creating POST HTTP requests in Go
// package main
import (
"bytes"
"io"
"mime/multipart"
"net/http"
"os"
"strings"
@Eggbertx
Eggbertx / buttonEvent.js
Last active December 24, 2018 20:37
A simple but handy button press/release event handler
/*
* A simple but handy button press/release event handler
*/
import { Thread } from "sphere-runtime";
var events = [];
export class ButtonEvent extends Thread {
constructor(device, button, onPress, onRelease) {
@Eggbertx
Eggbertx / personlib.js
Last active December 24, 2018 20:38
The miniSphere Personlib module
/*
* PersonLib 1.1.2018-07-09
* Copyright (c) 2016-2018, Eggbertx
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1 Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.