Skip to content

Instantly share code, notes, and snippets.

View coolreader18's full-sized avatar

Noa coolreader18

View GitHub Profile
#include <IRremote.h>
const int RECV_PIN = 7, LED_PIN = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;
unsigned long key_value = 0;
void setup() {
Serial.begin(9600);
import a
import functools
ready = object()
go = object()
def run(coro, *, payload=None, error=False):
send = coro.throw if error else coro.send
#!/bin/bash
INFO_LINES=4
dir=.
while getopts "d:" opt; do
case "$opt" in
d)
dir=$OPTARG
@coolreader18
coolreader18 / odt2md.sh
Last active July 26, 2019 18:24
Convert a LibreOffice ODT file to a Hugo post.
#!/bin/bash
set -e
case $# in
0)
file=$(
zenity --file-selection \
--file-filter='*.odt' --file-filter='*.docx' --file-filter='*.*' \
--title "Select a document to publish:" \
2>/dev/null
This file has been truncated, but you can view the full file.
This file has been truncated, but you can view the full file.
<!doctype html>
<html>
<head>
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
@coolreader18
coolreader18 / no-remove-prefix.md
Last active July 1, 2019 23:29
How to fix Termux without removing $PREFIX

Open Termux (failsafe). Run pkg i libiconv and look at the errors it produces (cat, realpath, etc.). cd to $PREFIX/bin and run

./busybox ln -s busybox {cat,realpath,etc}

for each executable that's missing. When pkg i libiconv doesn't fail, run pkg i coreutils again and everything should be fixed!

inline fn wa_syscall(nr: usize) usize {
return asm volatile ("swi %[nr]"
: [ret] "={r}" (-> usize)
: [nr] "{i}" (nr)
: "memory", "r1", "r2", "r3", "r4", "r12", "lr"
);
}
inline fn wa_syscall1(nr: usize, p1: usize) usize {
return asm volatile ("swi %[nr]"
This file has been truncated, but you can view the full file.
use std::rc::*;
pub enum RefCount<T> {
Rc(Rc<T>),
Weak(Weak<T>),
}
impl<T> RefCount<T> {
pub fn new_rc(value: T) -> RefCount<T> {
RefCount::Rc(Rc::new(value))