Skip to content

Instantly share code, notes, and snippets.

@a-a
a-a / puck.js eddystone-ibeacon-example.js
Created March 4, 2018 18:19
Example code for getting Eddystone, iBeacon, or both advertising on a Puck.JS. Turns on/off with the button, and displays battery level too :)
// Eddystone and iBeacon example code for Puck.js 1.92 or above
// How to use: paste into the web IDE, adjust to your needs, and upload to your puck.
// Setup which type of advertising you wish to make, Eddystone, iBeacon, or both. Uncomment ONLY ONE.
function doAdvertising() {
doEddystone(); //By default, we advertise eddystone only.
//doiBeacon();
//advertiseBoth();
}
@a-a
a-a / sad.cpp
Created July 31, 2018 10:30
:(
#include "stdafx.h"
#include <stdio.h>
#include <time.h>
#include <chrono>
#include <thread>
#include <Windows.h>
void SetColorAndBackground(int ForgC, int BackC = 0) {
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
@a-a
a-a / sad2.c
Created August 1, 2018 10:24
:(
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <windows.h>
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
const char* RESET = "\x1B[0m";
@a-a
a-a / geniadconfig.sh
Last active August 31, 2018 16:49
Script to configure Cisco IAD2432-24FXS to switch 24 telephone ports locally.
#! /bin/bash
# Script to generate skeleton config for Cisco IAD2432-24FXS allowing it to switch 24 telephone ports locally. Extensions numbered 201-224. Apply this on top of a base (fresh from reset state) config to get phones to talk to each other.
for i in `seq 1 24`;
do
echo "voice-port 2/$(echo $(($i-1)))" #port 2/0
echo "ren 3"
echo "cptone gb"
echo "station-id number $(echo $(($i+200)))" #station-id 201
@a-a
a-a / dhcp-leases-to-dns.rsc
Last active August 31, 2020 13:23 — forked from SmartFinn/dhcp-leases-to-dns.rsc
MikroTik (RouterOS) script for automatically setting DNS records for clients when they obtain a DHCP lease
# MikroTik (RouterOS) script for automatically setting DNS records
# for clients when they obtain a DHCP lease.
#
# author SmartFinn <https://gist.github.com/SmartFinn>
# based on https://github.com/karrots/ROS-DDNS
# modified 20200412 a-a to allow multiple IPs per host
# modified 20200417 a-a, add functionality to strip anything after hostname, add variables to control optional features.
# Set to "true" if adding multiple IP addresses to the same hostname is acceptable, ie for clients with wireless and a wire.
:local allowRoundRobin "true";
@a-a
a-a / tryfreq.sh
Created May 17, 2020 15:14
Script to send POCSAG messages on multiple known frequencies to known RIC where transmission paramaters are unknown.
#! /bin/bash
#
# Script to send POCSAG messages on multiple known frequencies to specified RIC
# This could be useful where the RIC is known, the frequency is unknown but
# suspected to be a former UK commercial paging network, but all other
# paramaters such as baud raud or inversion are unknown.
#
# You should be using this in an RF test chamber to avoid voilating the law.
# But if you're playing with pagers, you presumably already known this :)
@a-a
a-a / lilygo-t5-weather.ino
Created November 21, 2020 00:21
lilygo-t5-weather.ino
#include <gfxfont.h>
#include <Adafruit_SPITFT_Macros.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_GFX.h>
#include <Adafruit_GrayOLED.h>
/* ESP Weather Display using an EPD 2.7" Display, obtains data from Open Weather Map, decodes it and then displays it.
####################################################################################################################################
@a-a
a-a / fuckedifimraisingajtaccaseforthis.txt
Last active June 24, 2024 04:49
Force Juniper SRX110 to accept VDSL PIC firmware from later (published) jfirmware releases
# Force Juniper SRX110H2 to accept VDSL PIC firmware from Juniper jfirmware 17 release (For SRX300 series?)
# it might work, it might not. do this at your own risk etc. i think it rolls back. haven't tried lol.
# Testing using latest 17.4 release specifically from https://support.juniper.net/support/downloads/?p=junos-srx#sw.
# At time of writing, "latest" was jfirmware-srxsme-17.4R3.16-signed.tgz - copy your shit to a fat32 usb
# Make usb mountpoint (if you haven't already)
root@% mkdir /var/tmp/usb
# Mount the USB
root@% mount_msdosfs /dev/da0s1 /var/tmp/usb
@a-a
a-a / lib_systemd_system_pocsag-udp-relay.service
Created July 25, 2023 21:14
rpitx pocsag - simple and dirty udp forwarder
[Unit]
Description=POCSAG UDP Relay
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
[Service]
Type=simple
ExecStart=/usr/bin/python3 /usr/local/bin/pocsag-udp-relay.py
StandardInput=tty-force
Restart=on-failure
@a-a
a-a / 10-wayland.conf
Last active November 29, 2023 16:56
pure wayland sddm on debian bookworm (raspberry pi 5, but probably similar for x86 and friends)
[General]
DisplayServer=wayland
[Wayland]
# Path of the directory containing session files
SessionDir=/usr/share/wayland-sessions
# Path of script to execute when starting the desktop session
SessionCommand=/usr/share/sddm/scripts/wayland-session