Skip to content

Instantly share code, notes, and snippets.

@omerk
omerk / script.ts
Last active January 26, 2023 04:08
Mastodon RSS to Twitter (via IFTTT, with some transformation)
// Trim Mastodon RSS feed and add a reference to the original status URL
// This needs the Pro+ feature "Filter Code" blocks on IFTTT
let status_text = Feed.newFeedItem.EntryContent;
let status_url = Feed.newFeedItem.EntryUrl;
const tweet_max_length = 280;
// reference to original mastodon post
let footer = "\n\n(from ".concat(status_url).concat(")");
@omerk
omerk / znp-uart-test.py
Last active June 2, 2021 02:35
ZNP UART Comms Test
#!/usr/bin/env python3
# znp-uart-test
#
# Use this script as a sanity check after you burn the ZNP coordinator
# firmware on your zzh stick.
#
# !! Before you run this script, make sure you flash the
# latest Z-Stack Coordinator firmware on your zzh stick.
#
C:\ti\ccsv8\ccs_base\common\uscif\xds110>xdsdfu.exe -e
USB Device Firmware Upgrade Utility
Copyright (c) 2008-2018 Texas Instruments Incorporated. All rights reserved.
Scanning USB buses for supported XDS110 devices...
<<<< Device 0 >>>>
$ ./enumerate_devices
+ usb-1-1-4-3@0 045e:07a5 (hid)
- device node: /dev/hidraw1
- manufacturer: Microsoft
- product: Microsoft® 2.4GHz Transceiver v9.0
+ usb-1-1-4-3@1 045e:07a5 (hid)
- device node: /dev/hidraw2
- manufacturer: Microsoft
- product: Microsoft® 2.4GHz Transceiver v9.0
+ usb-1-1-4-3@2 045e:07a5 (hid)
#!/bin/bash
TWFR_SCREEN=/dev/fb0
TWFR_USER=shibesbot
TWFR_ROTATE=180 # Comment this out if rotation is not necessary
# Grab the latest photo from timeline
twphotos -u $TWFR_USER -i -n 1 | grep "No new"
if [ $? == 0 ]; then
echo "no new photo"

Keybase proof

I hereby claim:

  • I am omerk on github.
  • I am omerk (https://keybase.io/omerk) on keybase.
  • I have a public key whose fingerprint is 8E24 2EDC BB06 6A3E 9707 3943 229F 528E CE28 FC66

To claim this, I am signing this object:

@omerk
omerk / gist:9353095
Created March 4, 2014 18:53
vim cheatsheet

Open/Edit/Close

cd <folder> change to folder

r <file> insert file below cursor

r !<cmd> insert command output below cursor

o begin new line, insert

@omerk
omerk / rect2pad.py
Created January 21, 2014 22:00
Converts rectangles to SMD pads in Eagle 6.x libraries. Since this is essentially a quick hack, you should isolate the package you are working with into a new library and copy the resultant pad data into the file manually.
import sys
from xml.dom import minidom
def main():
print "Opening " + sys.argv[1]
xmldoc = minidom.parse(sys.argv[1])
rects = xmldoc.getElementsByTagName('rectangle')
print "Found " + str(len(rects)) + " rectangles"
@omerk
omerk / Makefile
Created November 5, 2013 17:35
Generic Makefile for the Parallella board.
ESDK=${EPIPHANY_HOME}
ELIBS=${ESDK}/tools/host/lib
EINCS=${ESDK}/tools/host/include
ELDF=${ESDK}/bsps/current/fast.ldf # Modify this for different linker options
EHDF=${EPIPHANY_HDF}
# Modify this to suit the name of your application.
# Host app should be: $APP.c and device app: e_$APP.c
APP=hello_world
-module(ale_halloween).
-export([start/0]).
init() ->
application:start(gproc),
gpio:start_link({4, output}),
gpio:start_link({17, output}),
gpio:start_link({18, output}),
gpio:start_link({27, output}),
gpio:start_link({22, output}),