Skip to content

Instantly share code, notes, and snippets.

import inspect
## utility stuff
def identity(x):
return x
def swap(t):
return tuple(reversed(t))
ld a, 1
loop:
nop
out (0), a ; LEDs are on port 0
inc a
jr loop
lex = Lexer()
lex['WS'] = regex.compile(r'\s+')
lex.ignore('WS')
lex['N'] = regex.compile(r'\d+')
for c in '+*()':
lex[c] = c
class MathBuilder(Builder):
"""
e.wrap -> t;
attrs==19.3.0
Click==7.0
cycler==0.10.0
joblib==0.14.1
kiwisolver==1.1.0
matplotlib==3.1.2
numpy==1.18.0
progressbar2==3.47.0
pyparsing==2.4.6
python-dateutil==2.8.1
@agrif
agrif / boot.l
Last active December 23, 2019 01:21
(set 'list (lambda args args))
(set 'setq
(macro (name value)
(list 'set (list 'quote name) value)))
(setq defun
(macro (name args . body)
(list 'setq name (cons 'lambda (cons args body)))))
from quartus_tcl import QuartusTcl
import tempfile
import os.path
import intelhex # install with: pip install intelhex
quartus = QuartusTcl()
# get hardware, device, and memory instance id
# (you might want to do something smarter here)
hw = quartus.get_hardware_names()[0]
# https://www.weather.gov/tg/awips
18a = "18 Hour WINTEM"
24a = "24 Hour WINTEM"
30l = "Average Monthly Weather Outlook (Local)"
3hr = "Routine Space Environment Product Issued Every 3 Hours"
5tc = "500 Millibar Type Correlation"
abv = "Rawinsonde Data Above 100 Millibars"
ada = "Alarm/Alert Administrative Msg (Urgent Notification)"
adm = "Alert Administrative Message"
@agrif
agrif / halting-problem.py
Created October 22, 2019 16:28
a crappy python proof that the halting problem is unsolvable
def halts(f, x):
# returns True if f(x) halts
# False if it runs forever
# notably, to solve the halting problem, it *must* return either True or False
# it can't just run forever...
return magic_turing_oracle(f, x)
def sneaky(f):
# see if f halts when passed itself as input...
if halts(f, f):
@agrif
agrif / 00Readme.md
Last active July 21, 2019 02:06
goestools example systemd unit files
  • Add files to /etc/systemd/system/
  • Edit as needed (change paths!)
  • Run:
    sudo systemctl start goesrecv
    sudo systemctl start goesproc
    
  • Verify they're running:

sudo systemctl status goesrecv

outputdir= "/var/www/webmaps"
def playerIcons(poi):
if poi['id'] == 'Player':
poi['icon'] = "https://overviewer.org/avatar/%s" % poi['EntityId']
return "Last known location for %s" % poi['EntityId']
def HomesFilter(poi):
if poi['id'] == 'Homes':
try:
return (poi['name'], poi['description'])