Skip to content

Instantly share code, notes, and snippets.

View nonchip's full-sized avatar
‼️
this is mostly to read/fork/archive. same name on gitlab because fuck microsoft.

Kyra Zimmer nonchip

‼️
this is mostly to read/fork/archive. same name on gitlab because fuck microsoft.
View GitHub Profile
#define PIN_TX 0x01 /* Orange wire on FTDI cable */
#define PIX_RX 0x02 /* Yellow */
#define PIN_RTS 0x04 /* Green */
#define PIN_CTS 0x08 /* Brown */
#define PIN_DTR 0x10
#define PIN_DSR 0x20
#define PIN_DCD 0x40
#define PIN_RI 0x80
@nonchip
nonchip / bangclock.c
Created January 8, 2017 19:17
libftdi bitbanged clocksource
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
//#include <ftd2xx.h>
#include <errno.h>
//#include <asm/errno.h>
#include <libftdi1/ftdi.h>
#include <time.h>
@nonchip
nonchip / avrdice.c
Last active February 10, 2017 09:38
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
#include <avr/sleep.h>
#include <avr/interrupt.h>
uint16_t ADC_Read( uint8_t channel )
{
ADMUX = (ADMUX & ~(0x1F)) | (channel & 0x1F);
ADCSRA |= (1<<ADSC);
import RAM, BankSwitcher from require 'ram'
ops=require 'ops'
rom=require 'rom'
eprint=(...)->
for i in *{...}
io.stderr\write i..'\t'
io.stderr\write '\n'
bank1 = RAM!
@nonchip
nonchip / main.py
Last active September 25, 2016 17:58
Python_stuff
import tweepy
f=open(".keys","r")
consumer_key=f.readline().rstrip().split()[0]
consumer_secret=f.readline().rstrip().split()[0]
access_token=f.readline().rstrip().split()[0]
access_token_secret=f.readline().rstrip().split()[0]
f.close()
@nonchip
nonchip / mitnfa.sh
Last active August 10, 2016 07:26
generates an MITNFA license for the current user
#!/bin/sh
#NOTICE: to get the license terms of this program, just run it with the following arguments:
# mitnfa.sh 2016 "Kyra Zimmer" "me@nonchip.de"
cat <<EOL
MIT +no-false-attribs License
Copyright © ${1:-$(date +%Y)} ${2:-$(git config --get user.name)} <${3:-$(git config --get user.email)}>
Permission is hereby granted, free of charge, to any person
require "luarocks.loader"
lgi = require "lgi"
Gtk = lgi.require "Gtk"
Gtk.init!
window = with Gtk.Window
title: 'window'
default_width: 400
default_height: 300
@nonchip
nonchip / IPC.moon
Last active April 7, 2016 10:52
kinda IPC like wrapping system for moonscript classes. might come in handy for nmoonlib
class IPC
dispatch: (name,...)=> -- call this on incoming calls
--print "dispatching: ",name,...
rawget(@@.__base, name) @, ...
call: (name, ...)=>
--print "calling: ",name,...
error "IPC.call: overload this to do outgoing calls"
client: (...)=>
old_mt=getmetatable @
b=@@.__base
@nonchip
nonchip / selfrun.sh
Last active February 28, 2016 15:15
#!/bin/bash
# selfrun.sh <executable>
# creates "<executable>.standalone" containing "." and extracting&running itself.
export _ROOT="/tmp/.nc.selfrun.$(uuidgen)-$(uuidgen)"
cat > "${1}.standalone" <<END
#!/bin/bash
export self="\$(readlink -f "\$0")"
if test -e $_ROOT
then cd $_ROOT
else
@nonchip
nonchip / once.zsh
Created December 19, 2015 12:52
/usr/local/bin/once: call a command exactly once per uptime. useful for e.g. startx in .profile
#!/bin/zsh
test -e /dev/shm/once.db || touch /dev/shm/once.db
if grep -q "$*" /dev/shm/once.db
then echo "$* already in oncedb" >&2
else
echo "$*" >> /dev/shm/once.db
"$@"
fi