Skip to content

Instantly share code, notes, and snippets.

View fxadecimal's full-sized avatar
👨‍💻

fxadecimal

👨‍💻
View GitHub Profile
@fxadecimal
fxadecimal / text2slideshow.sh
Last active August 29, 2015 14:14
A completely useless bash script to dump a file to a series of slides then into a slideshow
# bash script that generates a slide show from a file
# sudo apt-get install imagemagick libav-tools rar
# usages
# text2slideshow.sh [textfile] [number of lines]
# text2slideshow.sh index.html 10
wc -l $1
rm *.jpg
rm *.mp4
@fxadecimal
fxadecimal / audio2video.sh
Last active August 29, 2015 14:17
audio2video.sh - FFMpeg Audio to Video for youtube
#!/bin/bash -x
# Script that generates an image, then creates video file with audio. Was created for uploading audio to Youtube.
# You'll need ffmpeg and imageMagick (and ghostscript on OsX)
#
# example usage:
# audio2video.sh Music.wav "Big Label!"
TEXT=$2
AUDIOFILE=$1
IMAGE=background.png
@fxadecimal
fxadecimal / record.sh
Created April 9, 2015 15:14
Record audio directly to ogg
# usage:
# . record.sh 300 "hw:2,0"
# http://ubuntuforums.org/archive/index.php/t-224748.html
DATE=$(date "+%Y.%m.%d-%H.%M.%S")
DURATION=${1:-600}
HW=${2:-"hw:2,0"}
arecord -d $DURATION -D $HW -f cd -t raw | oggenc - -r -o $DATE.ogg
@fxadecimal
fxadecimal / git_backup.sh
Last active September 30, 2025 14:17
Git ZIP Backup
#!/bin/bash
HEAD=$(git rev-parse --short HEAD)
GIT_ROOT=$(git rev-parse --show-toplevel)
DIRNAME=${GIT_ROOT##*/}
NAME="${DIRNAME}_$HEAD.zip"
7z a -tzip $GIT_ROOT/../$NAME -w $GIT_ROOT/../$DIRNAME
echo "Wrote $GIT_ROOT/../$NAME"
@fxadecimal
fxadecimal / barcode_server.py
Created July 20, 2015 12:38
Simple prototype of a Barcode reader server using Flask.
#!/usr/bin/env python
# Prototyped with Barcode Scanner on Android and the "custom search" url
# https://play.google.com/store/apps/details?id=com.google.zxing.client.android&hl=en_GB
#
# Routes:
# http://[ip-address]:5001/
# http://[ip-address]:5001/add/[barcode]
@fxadecimal
fxadecimal / temperature.sh
Last active October 24, 2015 11:36
ds18b20 simple temperature reader
#!/usr/bin/env bash
# Turn on one-wire support for rPi
# https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/ds18b20
cat /sys/bus/w1/devices/28*/w1_slave |\
grep t= | awk -F't=' '{print $2}' | \
python3 -c 'import sys; sys.stdout.write( str( float(sys.stdin.read())/1000 ) )'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fxadecimal
fxadecimal / timeme.py
Created April 28, 2016 12:24
Python timer function decorator
"""
Simple timer function decorator
"""
import time
def timeme(func):
def inner(*args, **kwargs):
fname = func.func_name
start = time.clock()
@fxadecimal
fxadecimal / Sketchup-Makefile
Last active March 1, 2017 14:29
Makefile for Sketchup Plugins (osx). Assumes your code directory is under src/
APPNAME=My Sketchup Plugin
DISTNAME=MyPlugin
BUILDDIR = build
DISTDIR = dist
SRCDIR = src
ENCRYPTOOL = /Applications/SketchupScrambler
GIT_DIR = $(shell git rev-parse --show-toplevel)
@fxadecimal
fxadecimal / bootstap_4.1.html
Created October 3, 2018 12:24
Bootstrap 4.1 Hello World CDN and Navbar
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">