Skip to content

Instantly share code, notes, and snippets.

View gyaresu's full-sized avatar

Gareth gyaresu

View GitHub Profile
@liushooter
liushooter / uninstall-haskell-osx.sh
Last active November 15, 2017 01:49 — forked from gatlin/uninstall-haskell-osx.sh
Uninstall Haskell from Mac OS X
#!/bin/bash
# source: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090170.html
sudo rm -rf /Library/Frameworks/GHC.framework
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
sudo rm -rf /Library/Haskell
rm -rf .cabal
rm -rf .ghc
rm -rf ~/Library/Haskell
@ktemkin
ktemkin / mockup.py
Last active February 6, 2023 19:49
# Creating a GreatFET object implicitly opens the USB connection to the device.
try:
device = GreatFET() # Optionally accepts serialNo= to select between multiple GreatFETs.
except DeviceNotFoundException:
print("No device found!")
sys.exit()
# Once a connection is made, the board's ID is queried, and used to make the board's peripherals available.
# (This either would be a factory method that produces an appropriate class, or a run-time mixin.)
# For now, this would mean that objects are present on 'device' that allow access to each of the Azalea board's peripherals.
@dev-zzo
dev-zzo / tutorial.md
Last active February 9, 2023 00:08
ChameleonMini fun

Getting it to work

The device is shipped with test firmware installed. To burn a proper firmware, you will need:

The instructions on the blog page are incorrect because Rev G hardware uses ATxmega128A4U instead of ATxmega32A4U. Why? Probably an outdated version of hardware.

#!/bin/bash
cat $1 | grep '^IRA:' > $1_positions.csv
sed -i -e 's/^.\+sat:/sat:/' -e 's/\( RAI\:.\+\)\|\(sat:\)\|\(beam:\)\|\(pos=(\)\|\()\)\|\(alt=\)\|\(+\)//g' -e 's%/%;%' -e 's/ /;/g' -e '/^00;00/d' -e 's/$/000/g' -e '/[0-9]\+;[0-9]\+;\([0-9]\+\|-[0-9]\+\).[0-9]\+;\([0-9]\+\|-[0-9]\+\).[0-9]\+;[0-9]\+/!d' $1_positions.csv
awk -F ';' '($5<=100000){print}' $1_positions.csv > $1_positions_spotbeams.csv
awk -F ';' '($5>100000){print}' $1_positions.csv > $1_positions_satellites.csv
sed -i '1 i\satellite;beam;latitude;longitude;altitude' $1_positions*.csv
anonymous
anonymous / application.c
Created April 27, 2017 04:58
#include "stm32f4xx_hal.h"
#include "main.h"
#include "spi.h"
#include "usart.h"
#define QUAN_SPI_BYTES 8
#define LIS3DSH_READ 0x80U
#define LIS3DSH_WRITE 0x00U

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals

@ryankurte
ryankurte / hardfault.c
Last active October 8, 2017 16:00
Cortex M Hardfault Handler
// A HardFault handler to make life easier when debugging
// See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/Cihcfefj.html
// The smol version
void HardFault_Handler(void) {
SCB_Type* scb = SCB;
(void*)scb;
__asm("BKPT #0");
while(1);
}
@27Bslash6
27Bslash6 / beep.sh
Last active January 3, 2023 09:41
OSX Bash script that beeps a pure sinewave, variable by number of beeps, delay and volume
#!/usr/bin/env bash
#shellcheck disable=SC2034
# beep
# *********************************************************
# Generate a beep shell command for OSX 10.7.5+
# Original idea (C)2012, B.Walker, G0LCU.
# Now issued as Public Domain, CC0. You may do with it as you please.
repeat=${1:-1}
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active July 3, 2025 21:22
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created