Skip to content

Instantly share code, notes, and snippets.

@jacek64
jacek64 / gistfile1.py
Created February 6, 2016 21:03
Load Json into a Python object
# Load Json into a Python object
import urllib2
import json
req = urllib2.Request("http://localhost:81/sensors/temperature.json")
opener = urllib2.build_opener()
f = opener.open(req)
json = json.loads(f.read())
print json
print json['unit']
@jacek64
jacek64 / volumio-gpio-buttons.py
Created December 19, 2016 23:10 — forked from ivesdebruycker/volumio-gpio-buttons.py
Control Volumio2 with GPIO buttons
# https://volumio.org/forum/gpio-pins-control-volume-t2219.html
# https://pypi.python.org/pypi/socketIO-client
# https://volumio.github.io/docs/API/WebSocket_APIs.html
import RPi.GPIO as GPIO
import time
import subprocess
from socketIO_client import SocketIO, LoggingNamespace
@jacek64
jacek64 / deb2tcz.sh
Created August 19, 2017 19:39 — forked from nuxlli/deb2tcz.sh
Convert debian package to tce/tcz package
#!/bin/bash
# Create tce/tcz from Debian package
# Usage: $ scriptname packagename.deb packaganame.tce
# Depends: squashfs-tools, findutils, binutils
# References:
# - http://forum.tinycorelinux.net/index.php/topic,2325.msg12127.html
# - http://pastebin.com/ed5KSPsH
TMP1="`mktemp -d /tmp/tce.1.XXXXXX`"
TMP2="$TMP1"/pkg
@jacek64
jacek64 / pyside_threading_example
Created August 19, 2017 19:41
PySide Threading
#!/usr/bin/env python2
import sys, time
from PySide.QtGui import *
from PySide.QtCore import *
class MySignal(QObject):
sig = Signal(str)
class MyLongThread(QThread):
// Sample Configuration File for Shairport Sync
// Commented out settings are generally the defaults, except where noted.
// General Settings
general =
{
name = "AirPi"; // This means "Hostname" -- see below. This is the name the service will advertise to iTunes.
// The default is "Hostname" -- i.e. the machine's hostname with the first letter capitalised (ASCII only.)
// You can use the following substitutions:
// %h for the hostname,
@jacek64
jacek64 / Lenovo IdeaPad Y530 - Linux Mint
Last active August 29, 2017 14:24 — forked from anonymous/-
Lenovo IdeaPad Y530 - Linux Mint
System: Host: lenovo Kernel: 4.10.0-33-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.4.6 (Gtk 3.18.9-1ubuntu3.3) dm: lightdm Distro: Linux Mint 18.2 Sonya
Machine: System: Lenovo (portable) product: INVALID v: Lenovo IdeaPad Y530
Mobo: Lenovo model: INVALID v: 10CN37WW Bios: Lenovo v: 10CN38WW date: 10/08/2008
Chassis: type: 10 v: 10CN38WW
CPU: Dual core Intel Core2 Duo P8600 (-MCP-) cache: 3072 KB
flags: (lm nx sse sse2 sse3 sse4_1 ssse3 vmx) bmips: 9600
clock speeds: min/max: 800/2401 MHz 1: 2401 MHz 2: 1600 MHz
Graphics: Card: NVIDIA G96M [GeForce 9600M GS] bus-ID: 01:00.0 chip-ID: 10de:0648
Display Server: X.Org 1.18.4 drivers: nouveau (unloaded: fbdev,vesa)
/*
ffmpeg -i "$file" -f s32be -acodec pcm_s32be -ar 44100 -af "volume=0.5" tcp://espip:5522
*/
#include "i2s.h"
#include <ESP8266WiFi.h>
const char* ssid = "***********";
const char* password = "**********";
WiFiServer pcmServer(5522);
static WiFiClient pcmClient;
@jacek64
jacek64 / 1st_wr703n-image-create.sh
Created January 19, 2018 13:58 — forked from probonopd/1st_wr703n-image-create.sh
Working way to create a simple Ethernet/WLAN web radio player using a cheap tiny WR703N router and a cheap USB C-Media soundcard. Switch radio stations with the reset switch. -- THE ACTUAL CODE ON THIS PAGE IS ***OUTDATED***, use https://github.com/probonopd/minikrebs instead!
# http://www.aliexpress.com/item/New-Mini-Portable-Wireless-3G-Router-TP-LINK-TL-WR703N-150M-150Mbps-WR703N-Pocket-size-Wifi/948558329.html
# Someone should convince TP-Link to build this with more Flash, serial headers, bare board, *duino style...
# This is the starting point for a webradio appliance in the works
# TODO: Preconfigure everything, hook up Arduino for IR control sending and receiving
wget http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486.tar.bz2
tar xfj OpenWrt-ImageBuilder*
cd "$HOME/Downloads/OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486"
@jacek64
jacek64 / mplayer.html
Created May 30, 2018 09:37 — forked from meeuw/mplayer.html
control mplayer with python bottle web interface
<html>
<head>
<link href="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/css/base/jquery.ui.all.css" rel="stylesheet">
<link href="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.2/css/lightness/jquery-ui-1.10.2.custom.min.css" rel="stylesheet">
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.2/jquery.ui.touch-punch.min.js"></script>
<script src="http://localhost:8080/mplayer"></script>
<script>
$(function () {
@jacek64
jacek64 / GoogleMapDownloader.py
Created November 12, 2018 10:22 — forked from eskriett/GoogleMapDownloader.py
A python script to download high resolution Google map images given a longitude, latitude and zoom level.
#!/usr/bin/python
# GoogleMapDownloader.py
# Created by Hayden Eskriett [http://eskriett.com]
#
# A script which when given a longitude, latitude and zoom level downloads a
# high resolution google map
# Find the associated blog post at: http://blog.eskriett.com/2013/07/19/downloading-google-maps/
import urllib
import Image