Skip to content

Instantly share code, notes, and snippets.

View G10DRAS's full-sized avatar

G10DRAS G10DRAS

View GitHub Profile
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()
#!/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
lsusb -v -d 05e1:0408 | grep tSamFreq | sed -e "s,^.* ,,"
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
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
@G10DRAS
G10DRAS / volumeUP.sh
Created August 10, 2016 16:27
Script to increse Volume
#!/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
@G10DRAS
G10DRAS / volumeup.py
Created August 11, 2016 00:01
Python Script to Volume control MPD
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']
@G10DRAS
G10DRAS / sqliteDemo.py
Last active June 29, 2018 10:36
SQLite Script
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);""")
@G10DRAS
G10DRAS / sendText.py
Created August 11, 2016 07:56
Twilio Script
from twilio.rest import TwilioRestClient
accountSID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
authToken = 'xxxxxxxxxxxxxxxxxxxxxxxx'
myTwilioNumber = '+xxxxxxxxxxxxxxxxxx'
myCellPhone = '+xxxxxxxxxxxx'
def text(message):
twilioCli = TwilioRestClient(accountSID, authToken)
@G10DRAS
G10DRAS / PyAudioPocketSphinx.py
Last active September 8, 2016 02:33
PocketSphinx with PyAudio Recording
#!/usr/bin/env python
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
import os
import pyaudio
import wave
import audioop
from collections import deque