This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
import time | |
button = 20 | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(button, GPIO.IN, pull_up_down=GPIO.PUD_UP) | |
input_state = GPIO.input(button) | |
print input_state | |
GPIO.cleanup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}') | |
YELLOW="\033[1;33m" | |
RED="\033[0;31m" | |
ENDCOLOR="\033[0m" | |
if [ $USER != root ]; then | |
echo -e $RED"Error: must be root" | |
echo -e $YELLOW"Exiting..."$ENDCOLOR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lsusb -v -d 05e1:0408 | grep tSamFreq | sed -e "s,^.* ,," |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To resize swap space: | |
sudo nano /etc/dphys-swapfile | |
CONF_SWAPSIZE=750 | |
sudo dphys-swapfile setup | |
sudo dphys-swapfile swapon | |
ls -l /var/swap | |
free -h | |
sudo apt-get --purge clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MOBITRAN | |
bluetoothd[3759]: audio/headset.c:handle_event() Received AT+CLIP=1 | |
bluetoothd[3759]: audio/headset.c:handle_event() Received AT+NREC=0 | |
bluetoothd[3759]: audio/telephony.c:telephony_nr_and_ec_req() telephony-dummy: got disable NR and EC request | |
bluetoothd[3759]: audio/transport.c:headset_nrec_changed() | |
bluetoothd[3759]: audio/headset.c:handle_event() Received AT+VGS=15 | |
bluetoothd[3759]: audio/headset.c:handle_event() Received AT+VGM=15 | |
bluetoothd[3759]: audio/headset.c:handle_event() Received AT+XAPL=ABCD-1234-0100,1 | |
bluetoothd[3759]: audio/headset.c:apple_command() Got Apple command: AT+XAPL=ABCD-1234-0100,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VOL=`amixer get PCM | grep on] ` | |
VOL=`echo $VOL | cut -f 2 -d '[' | cut -f 1 -d '%' ` | |
VOL=$((VOL+10)) | |
if (("$VOL" > 100)); then | |
VOL=100 | |
elif (("$VOL" < 0)); then | |
VOL=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mpd | |
client = mpd.MPDClient() | |
client.timeout = None | |
client.idletimeout = None | |
client.connect('localhost', 6600) | |
client.listplaylists() | |
client.load("RADIO") | |
client.playlist() | |
client.status()['volume'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
def Main(): | |
try: | |
con = sqlite3.connect('sqlite.db') | |
cur = con.cursor() | |
cur.executescript("""DROP TABLE IF EXISTS Animal; | |
CREATE TABLE Animal(Id INT, Name TEXT, Price INT);""") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twilio.rest import TwilioRestClient | |
accountSID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
authToken = 'xxxxxxxxxxxxxxxxxxxxxxxx' | |
myTwilioNumber = '+xxxxxxxxxxxxxxxxxx' | |
myCellPhone = '+xxxxxxxxxxxx' | |
def text(message): | |
twilioCli = TwilioRestClient(accountSID, authToken) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from pocketsphinx.pocketsphinx import * | |
from sphinxbase.sphinxbase import * | |
import os | |
import pyaudio | |
import wave | |
import audioop | |
from collections import deque |
OlderNewer