Skip to content

Instantly share code, notes, and snippets.

@Macrofig
Macrofig / broken-light.ino
Last active April 18, 2025 00:09
traffic light
#define RED 16
#define YELLOW 5
#define GREEN 4
void setup()
{
pinMode(RED,OUTPUT);
pinMode(YELLOW,OUTPUT);
pinMode(GREEN,OUTPUT);
Serial.begin(9600);
@Macrofig
Macrofig / frame-test-frame.html
Last active July 2, 2024 02:41
Frame testing
<html>
<head>
<title>Frame Same Origin test</title>
</head>
<body>
<h1>This is an iframe!</h1>
<script type="text/javascript">
(function () {
console.log('FRAME', document.domain, window.location.origin)
console.log('TOP', window.top.domain, window.top.location.origin)
@Macrofig
Macrofig / cloudflare-dns-delete-records.js
Created November 9, 2022 17:12
For some reason, when moving a website to Cloudflare, there were over a hundred DNS entries. This script goes through the UI and deletes them all. **Super rough draft.**
const generateDeleteEntries = () => {
const isDialogOpen = () => Boolean(document.querySelector("[role='dialog']"))
const isDeleteVisible = () => Boolean(document.querySelector("[data-testid='dns-record-form-delete-button']"))
const awaitHandler = (predicate, cb, count = 0) => () => {
if (predicate()) {
console.log('done waiting!!')
cb();
} else {
if (count > 5) {
console.log('UH OH, it took too long!')

Keybase proof

I hereby claim:

  • I am macrofig on github.
  • I am juanorozco (https://keybase.io/juanorozco) on keybase.
  • I have a public key ASCAGfNR346zySvP2C-pukHnVDk5M_Td8cFJZgPsTqmpXQo

To claim this, I am signing this object:

@Macrofig
Macrofig / eslint.json
Created March 13, 2018 17:05
Default eslint I am testing out
{
"rules": {
"comma-dangle": [2,"never"],
"no-cond-assign": [2,"except-parens"],
"no-console": 2,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-dupe-args": 2,
"no-dupe-keys": 2,
@Macrofig
Macrofig / mac-key-shortcuts-win10.ahk
Last active February 2, 2020 14:23
Autohotkey script to emulate some MacOS keyboard shortcuts on Windows
/*
Attempts to add MacOS keyboard shortcuts/commands to Windows
NOTE:
In many cases, I use the CTRL key because I am using a Mac keyboard and
therefore swapped the COMMAND (Windows) key with the CONTROL key.
See this blog post, specifcally the "On Windows" section:
https://www.howtogeek.com/219156/how-to-remap-your-windows-cutcopypaste-to-os-x-like-controls-and-vice-versa/
Might need to download Sharpkeys from here: https://github.com/randyrants/sharpkeys/releases
@Macrofig
Macrofig / copy-code-with-git-hx.sh
Last active July 6, 2016 17:58
Commands to copy component from one repo to another along with git history
# Credit to this article for the following commands:
# http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
# Prepare the source repo
mkdir ~/move-commits/source
git clone <git-url> ~/move-commits/source
cd ~/move-commits/source
@Macrofig
Macrofig / convert-photos.sh
Last active September 4, 2017 20:02
Convert GoPro time lapse photos to GIF. Bonus MP4 output, too.
# I find that the delay is pretty good at 10 if there are a lot of shots.
# A delay of 5 gives it a more speedy look.
# Finds all jpg files in current folder and creates a file called animated.gif.
# Also resizes images to 800 by 600 size so output gif will be same.
gm convert -size 800x600 *.jpg -delay 5 -resize 800x600 animated.gif
# Create an mp4 version while we are at it
ffmpeg -i animated.gif -c:v libx264 -crf 12 -b:v 500K animated.mp4
# Skip the graphicsmagick stuff and just use ffmpeg to concatenate images into a video
@Macrofig
Macrofig / keymap.cson
Last active May 17, 2016 16:44
Atom Editor: Die Command Q, DIE!
'body':
'ctrl-cmd-q': 'application:quit'
'cmd-q': 'unset!'
@Macrofig
Macrofig / minecraft.conf
Created May 1, 2016 04:25
init.d script that manages Minecraft PE service
#!/bin/sh
### BEGIN INIT INFO
# Provides: minecraft
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Manages Minecraft PE (Genisys) server.
### END INIT INFO