Skip to content

Instantly share code, notes, and snippets.

@tausen
tausen / infinilog.py
Created September 22, 2023 20:31
InfiniTime bluetooth attribute logging
#!/usr/bin/env python3
import time
import struct
import asyncio
from bleak import BleakClient, BleakScanner, exc
from bleak.backends.characteristic import BleakGATTCharacteristic
UUID_HEARTRATE = '00002a37-0000-1000-8000-00805f9b34fb'
@tausen
tausen / parse_mem_dat.c
Created March 8, 2022 15:43
memusage dat parser
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
struct entry {
uint64_t heap;
uint64_t stack;
uint32_t time_low;
uint32_t time_high;
};
@tausen
tausen / Outlook-style replies with mu4e.md
Last active March 29, 2020 11:37
Dirty, dirty hacks to support Outlook HTML reply styles in mu4e
@tausen
tausen / fontawesome.sty
Created April 5, 2018 19:38 — forked from jasonkhanlar/fontawesome.sty
FontAwesome mapping for XeLaTeX
% FontAwesome (http://fortawesome.github.com/Font-Awesome/) bindings for (Xe)LaTeX
% Author: Honza Ustohal <honza@egoistic.biz>
% Updated to match FontAwesome v4.5.0 by Jason Khanlar <jason.khanlar@gmail.com>
%
% Translation of FontAwesome's private range characters into XeTeX symbols. All icons are camel-cased and prefixed with 'fa', i.e. what was .icon-align-center the CSS version of FontAwesome becomes \faAlignCenter
% This might be reworked into a full blown package in the near future
%
% Prerequisite:
% XeLaTeX, FontAwesome installed as a system font accessible by XeLaTeX
%
@tausen
tausen / shiftaddmult.vhd
Created April 7, 2014 14:19
shiftaddmult
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity shiftaddmult is
generic (WIDTH: integer := 8);
port (
clk: in std_logic;
reset: in std_logic;
@tausen
tausen / bfin_sport.h
Created May 4, 2013 09:27
Analog Devices Blackfin SPORT
/*
* bfin_sport.h - interface to Blackfin SPORTs
*
* Copyright 2004-2009 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#ifndef __BFIN_SPORT_H__
#define __BFIN_SPORT_H__
#!/bin/bash
case $1 in
0) xloadimage -zoom 70 -onroot ~/Pictures/emergence_by_alexiuss-d4n7gur.jpg ;;
1) xloadimage -zoom 100 -onroot ~/Pictures/emergence_by_alexiuss-d4n7gur.jpg ;;
2) xloadimage -fullscreen -onroot ~/Pictures/Metro_wallpaper2_1280x800.jpg 100 ;;
3) xloadimage -fullscreen -onroot ~/Pictures/Metro_wallpaper2_1920x1200.jpg 100 ;;
4) xloadimage -fullscreen -onroot ~/Pictures/Metro_wallpaper_1280x800.jpg 100 ;;
5) xloadimage -fullscreen -onroot ~/Pictures/Metro_wallpaper_1920x1200.jpg 100 ;;
*) echo 'Bad number'
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
import XMonad.Hooks.UrgencyHook
import XMonad.Actions.SpawnOn
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
import XMonad.Actions.GridSelect
@tausen
tausen / gist:4261887
Created December 11, 2012 20:30
pthread, sem_wait, sem_post example
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <semaphore.h>
sem_t semaphore;
void threadfunc() {
@tausen
tausen / gist:3871013
Created October 11, 2012 08:35
Pstricks & pst-circ example
\begin{figure}[h!]
\begin{centering}
\begin{pspicture}(5,3)
%\psgrid % uncomment to show grid :)
\resistor[dipolestyle=zigzag,labeloffset=0.6](1,2)(3,2){$R_1$}
\newcapacitor[arrows=*-](3,2)(3,1){$C_1$}
\newground[connectingdot=false](3,1)
\wire[arrows=-o,arrowscale=1.5](1,2)(0.5,2)
\wire[arrows=-o,arrowscale=1.5](3,2)(4,2)
\rput(0,2){$V_i$}