Skip to content

Instantly share code, notes, and snippets.

@StaticRocket
StaticRocket / rapid-clone.sh
Last active October 13, 2023 00:19
Quickly backup and deploy bootable SD cards with variable size ext4 root partitions
#!/bin/sh
[ -z "$PART_PREFIX" ] && PART_PREFIX=''
DD_ARGS='status=progress conv=fsync'
backup() {
src="$1"
dst="$2"
sfdisk -d "${src}" > "${dst}-table.txt"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ansarid
ansarid / example.md
Created August 1, 2019 22:04
mjpg_streamer opencv module
sudo apt update
sudo apt install mjpg-streamer-opencv-python

Create filter file. (/home/debian/opencv_filter.py)

import cv2
import numpy as np
obj-m += uio_pruss_shmem.o
all:
make -C /lib/modules/`uname -r`/build M=`pwd` V=1 ARCH=arm modules
install:
make -C /lib/modules/`uname -r`/build INSTALL_MOD_PATH=/lib/modules/`uname -r` M=`pwd` V=1 ARCH=arm modules_install
cd /lib/modules/`uname -r`
depmod -a
/opt/scripts/tools/developers/update_initrd.sh
@pranav083
pranav083 / GPIO_p8_11_led3.p
Created June 11, 2019 22:09
gpio not working p8.11
.origin 0
.entrypoint START
// the number of times we blink the LED
#define NUMBER_OF_BLINKS 10
#define GPIO_BANK1 0x4804c000
#define GPIO1_LED3BIT 1<<24
#define GPIO_SETDATAOUT 0x194
#define GPIO_CLEARDATAOUT 0x190
@j8r
j8r / compile-crystal-arm64.sh
Last active April 27, 2023 17:59
Compile a Crystal program to a statically linked arm64 binary
#!/bin/sh -eu
LOCAL_PROJECT_PATH=${1-$PWD}
BUILD_COMMAND="
shards build --static --release
chown 1000:1000 -R bin
"
INSTALL_CRYSTAL="
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/community' >>/etc/apk/repositories
apk add --update --no-cache --force-overwrite \
@pwntr
pwntr / EAGLE.desktop
Created February 11, 2019 09:20
Proper EAGLE PCB E-CAD desktop launcher for Ubuntu/GNOME
# copy this file to ~/.local/share/applications/. Change installation paths below to fit your setup.
[Desktop Entry]
Version=9.3.0
Type=Application
Terminal=false
Name=EAGLE
Comment=PCB design: schematic capture, board layout, and autorouter
# paths need to be absolute, no ~ allowed within this file
@JasonLS
JasonLS / 7segment.c
Created August 28, 2018 20:09
C code to use baconbits two 7 segment displays
#include <stdio.h>
#include <unistd.h>
int main() {
FILE * spidev = fopen("/dev/spidev2.1", "wb");
//Left 7 Segment
fwrite("\x40\x00\xc0", 1, 3, spidev);//"0's" are on, "1's" are off
//Right 7 Segment
fwrite("\x40\x01\xc0", 1, 3, spidev);
//You should see the segments look like zeroes.
@pdp7
pdp7 / BB-SPIDEV1-00A0.dts
Last active January 8, 2023 16:59
src/arm/BB-SPIDEV1-00A0.dts modify to add tinydrm st7735r for Adafruit 1.8" TFT LCD connected to BeagleBone Black running 4.16.0-rc2-bone3 kernel. More info: https://groups.google.com/d/msg/beagleboard/GuMQIP_XCW0/b3lxbx_8AwAJ
/*
* Copyright (C) 2013 CircuitCo
*
* Virtual cape for SPI1 on connector pins P9.29 P9.31 P9.30 P9.28
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
@Papierkorb
Papierkorb / 000_HOWTO.md
Last active March 9, 2024 17:59
Dynamic library in Crystal

Writing a dynamic library in Crystal, and calling it from C

  • Download all files.
  • Build the Crystal part:
crystal build --release --cross-compile --prelude ./no_main library.cr
              ^ You can leave this out
                        ^ We want to link ourselves!
 ^ Use our custom prelude!