Skip to content

Instantly share code, notes, and snippets.

#%RAML 0.8
title: World Music API
baseUri: http://example.api.com/{version}
version: v1
schemas:
- halLink: |
{ "$schema": "http://json-schema.org/schema",
"type": "object",
"description": "a Hypertext Application Language link",
@joegaffey
joegaffey / D3 sequence diagram
Last active July 13, 2023 00:42
D3.js sequence diagram
<!DOCTYPE html>
<meta name="robots" content="noindex">
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Sequence Diagram</title>
</head>
<body>
@joegaffey
joegaffey / file_sort_month.sh
Last active January 1, 2018 14:01
Sort files into folders by month. Pass file name pattern in a parameter in quotes e.g. '*.jpg'.
#!/bin/bash
months='Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'
echo $months | xargs mkdir
for month in $months
do
ls -l $1 | grep $month | awk '{print $NF}' | xargs -I {} mv {} ./$month
done
@joegaffey
joegaffey / file_sort_month_num.sh
Last active January 1, 2018 14:03
Sort files into folders by month number. Pass file name pattern in a parameter in quotes e.g. '*.jpg'.
#!/bin/bash
months=(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
monthNums='01 02 03 04 05 06 07 08 09 10 11 12'
echo $monthNums | xargs mkdir
i=0
for monthNum in $monthNums
do
ls -l $1 | grep ${months[$i]} | awk '{print $NF}' | xargs -I {} mv {} ./$monthNum
@sabas1080
sabas1080 / ESP32_HID.ino
Last active January 28, 2024 10:34
Example of HID Keyboard BLE with ESP32
/*
Copyright (c) 2014-2020 Electronic Cats SAPI de CV. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@joegaffey
joegaffey / scraper.js
Created July 25, 2018 10:55
Simple scraper snippet. Paste it into the console of a page with a list of links where you want to pull specific items from each link. Change selector consts according to your needs.
const linksSelector = '.link-selector';
const itemSelectors = ['.item1', '.item1', '.item1'];
const anchors = document.querySelectorAll(linksSelector);
const links = [];
anchors.forEach((anchor) => { links.push(anchor.href) });
const results = [];
links.forEach((link) => {
// Simple gamepad example that demonstraits how to read five Arduino
// digital pins and map them to the Arduino Joystick library.
//
// The digital pins are grounded when they are pressed.
//
// NOTE: This sketch file is for use with Arduino Leonardo and
// Arduino Micro only.
//
// Modified version of original code by Matthew Heironimus
// 2018-08-11
@GameDragon2k
GameDragon2k / ESP32_BLE_Arcade.ino
Last active February 15, 2023 08:47
NodeMCU-32S Game Pad
/*
Video: https://www.youtube.com/watch?v=oCMOYS71NIU
Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleNotify.cpp
Ported to Arduino ESP32 by Evandro Copercini
Gamepad coding by Game Dragon
*/
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
@joegaffey
joegaffey / index.html
Last active July 10, 2023 19:47
Basic annotation UI// source https://jsbin.com/xogegejowe
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Basic annotation UI">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<p>
I will arise and go now, and go to Innisfree,
And a small cabin build there, of clay and wattles made;
Nine bean-rows will I have there, a hive for the honey-bee,
let html = "<img src='"+temp1.toDataURL()+"' alt='from canvas'/>";
let tab = window.open();
tab.document.write(html);