Skip to content

Instantly share code, notes, and snippets.

View hamidzr's full-sized avatar
🎯
[~/] # ...

Hamid Zare hamidzr

🎯
[~/] # ...
View GitHub Profile
[SwitchyOmega Conditions]
; Require: SwitchyOmega >= 2.3.2
; Date: 12/21/2016
; Usage: https://github.com/FelisCatus/SwitchyOmega/wiki/RuleListUsage
*.digitaltrends.com
*.krxd.net
*.pinterest.com
*.costco.com
*.att.com
@hamidzr
hamidzr / rev-youtube-playlist-urls.sh
Created April 23, 2017 14:07 — forked from amberj/rev-youtube-playlist-urls.sh
This (bash) script takes a youtube playlist URL as argument and outputs title and URL of each video (in playlist) in reverse order
#!/bin/bash
#
# File: rev-youtube-playlist-urls.sh
# Description: This (bash) script takes a youtube playlist URL as argument and outputs title and URL of each video (in playlist) in reverse order (i.e. starting from last video in playlist)
# Author: Amber Jain
# Check if "only one" argument (playlist_url) passed as input:
if [ "$#" -lt "1" ]
then
echo "Invalid! You must pass playlist_url as argument"
@hamidzr
hamidzr / cs2201-combineReadmes.sh
Last active April 24, 2017 18:10
a helper to combine readme files for cs2201 (Vanderbilt)
#!/bin/bash
# rename each student's readmefile to his/her score and save to a single directory
# depends on these tools: bash, file, grep, unzip, sed
#relative output file address
output='readmes.txt'
echo '' > $output
for filename in *.*; do
@hamidzr
hamidzr / playOnKodi.sh
Created April 24, 2017 16:01
play generic uri to kodi instance.
#!/bin/bash
# pass a uri as an argument to play
curl -s --data-ascii '{"jsonrpc":"2.0","id":"1","method":"Application.SetVolume","params":{"volume":70}}' -H 'content-type: application/json;' http://localhost:8080/jsonrpc
curl -s --data-ascii '{"jsonrpc":"2.0","id":"1","method":"Player.Open","params":{"item":{"file":"'$1'"}}}' -H 'content-type: application/json;' http://hpi:8080/jsonrpc
@hamidzr
hamidzr / playATed.py
Last active April 25, 2017 16:02
surprise me with a random ted talk interesting to me.
#!/usr/bin/python3
#python3
import urllib.request
from urllib.parse import quote
import json
# configs
YOUTUBE_API='update me'
KODI_ADDRESS = 'http://localhost:8080'
@hamidzr
hamidzr / playYtSearch.py
Last active May 1, 2017 02:48
searches youtube with your search query and starts playing the first 50 results
#!/usr/bin/python3
#python3
import urllib.request
from urllib.parse import quote
import json
import sys
# configs
YOUTUBE_API='update me'
@hamidzr
hamidzr / playYtTrendingMusic.py
Last active May 21, 2017 22:34
Play trending youtube videos from a specific playlist randomly. The default playlist is trendin music of the week.
#!/usr/bin/python3
#python3
import urllib.request
from urllib.parse import quote
import json
import sys
# configs
YOUTUBE_API='updateme'
@hamidzr
hamidzr / weatherStations.py
Last active August 8, 2017 16:05
helper script to normalize and upload sensor readings from an arduino to thingspeak's MQTT broker
#!/usr/bin/python2.7
# normalize and publish weather sensor readings to thingspeak
from time import sleep
import datetime
import serial # install pySerial
import paho.mqtt.client as mqtt
import sys
SERIAL_PORT = sys.argv[2] if len(sys.argv) > 2 else '/dev/ttyUSB1'
/**
* @author Hamid Zare
* @email hamid.zare@vanderbilt.edu
*/
// the program would have been much faster and easier to write if the
// pagination was predictabe, meaning that I could grab the nth page directly
// in that case it would have been possible to fire all the request concurrently
// (after gettig the first response)
@hamidzr
hamidzr / pacaur_install.sh
Created October 25, 2017 18:00 — forked from tadly/pacaur_install.sh
A simple shell script to quickly / easily install "pacaur" on archlinux
#!/bin/sh
# If you are new to arch, I encourage you to at least read and understand what
# this script does befor blindley running it.
# That's why I didn't make a one-liner out of it so you have an easier time
# reading and understanding it :)
#
# This scripts purpose is purly to save you a few seconds on your new installation.
#
# Enjoy your time on an awesome system. Arch FTW!