Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import time
import usb
ftdi_eval = {
'tty': "/dev/ttyUSB3",
agners /
Created Jan 28, 2019
Update Python3 bytecode timestamps
# Python scripts which reads all Python bytecode files (pyc) and clears
# the timestamp (set to 0)
# This is useful for OSTree which clears modification time of all source
# files. Processed bytecode files are then not considered stale anymore.
import sys, os
import marshal
import importlib.util
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Stefan Agner
import os
import sys
import time
import usb
agners / main.c
Last active May 24, 2017 — forked from mlubin/newton.jl
i.MX 7 Cortex-M4 FreeRTOS C micro benchmark
View main.c
#include <math.h>
#include "FreeRTOS.h"
#include "task.h"
#include "board.h"
#include "debug_console_imx.h"
double squareroot(double x)
double it = x;
while (fabs(it*it - x) > 1e-13) {
agners / container.go
Last active Mar 12, 2017 — forked from 17twenty/container.go
Containerisation in 100 Lines of Go Code
View container.go
package main
import (
func main() {
agners / sort.c
Created Nov 2, 2013
quicksort/mergesort implementation in C
View sort.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ELEMENTS 100
void quicksort(int array[], int left, int right);
void mergesort(int array[], int length);
void printarray(int array[], int length)
agners / bashrc
Created Jun 17, 2013
Arch Linux bashrc with Git shell prompt
View bashrc
# /etc/bash.bashrc
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# Test for an interactive shell. There is no need to set anything
View gist:5787602
#!/bin/bash -e
OUT=`echo "$IN"|sed -e 's/wma$/mp3/'`;
echo "Will convert from $IN to $OUT";
echo Extracting...
mplayer -ao pcm:waveheader:file=/tmp/audiodump.wav "$IN" 2>/dev/null > /tmp/taginfo;
echo Encoding...
lame --id3v2-only -m j -h --vbr-new -b 192 "/tmp/audiodump.wav" -o "/tmp/$OUT";
agners / gist:5785663
Last active Dec 18, 2015 — forked from anonymous/gist:5785661
TS-7250 Reflash root
View gist:5785663
# apt-get install nfs-kernel-server tftpd xinetd
Setup TFTP
# vi /etc/xinetd.d/tftp
# Bash PS1 for Git repositories showing branch and relative path inside
# the Repository
# Reset
# Regular Colors
You can’t perform that action at this time.