import random
def binarySearch(alist, searchelement):
'''
binartsearch using divide and conqure(non-recursive).
@param: alist, unsorted list
@param: item, an element to be searched in alist
This file contains hidden or 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 socket | |
import random | |
import Queue | |
from threading import Thread | |
import logging | |
import os | |
import sys | |
import time,re,subprocess | |
reload(sys) | |
sys.setdefaultencoding('utf8') |
This file contains hidden or 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
while true; do score=`python -c 'import requests,re;from bs4 import BeautifulSoup; print(re.search(r"([A-Z]{3})([0-9]+\/[0-9]+ \([0-9]+.[0-9]\/[0-9]+ ov\))", BeautifulSoup(requests.get("http://www.espncricinfo.com/ci/engine/match/index.html").text[46695:48995],"lxml").text.strip()).group())'`; notify-send -t 10000 "Live match Score" "$score"; sleep 60; done & |
This file contains hidden or 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
{u'_id': u'scusr-0830fdaa-7188-41c3-a04c-ec0dec3b6a7c', | |
u'value': {u'active': 1.0, | |
u'appversion': u'5.6', | |
u'appversioncode': u'38', | |
u'campaign': None, | |
u'cat_count': [{u'key': u'other', u'value': 3.0}, | |
{u'key': u'phone', u'value': 1.0}], | |
u'city': None, | |
u'clickout_conv': 0.0, #? trans:clickout | |
u'clickout_count': 0.0, |
This file contains hidden or 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
{u'_id': u'scusr-0830fdaa-7188-41c3-a04c-ec0dec3b6a7c', | |
u'value': {u'active': 1.0, | |
u'appversion': u'5.6', | |
u'appversioncode': u'38', | |
u'campaign': None, | |
u'cat_count': [{u'key': u'other', u'value': 3.0}, | |
{u'key': u'phone', u'value': 1.0}], | |
u'city': None, | |
u'clickout_conv': 0.0, #? trans:clickout | |
u'clickout_count': 0.0, |
This file contains hidden or 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 unicodedata | |
my_text ="\U0001F602 and all of this \U0001F605" | |
for char in range(ord("\U0001F602"),ord("\U0001F64F")): | |
my_text=my_text.replace(chr(char),unicodedata.name(chr(char),"NOTHING")) | |
print(my_text) |
This file contains hidden or 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
fname=`date +"%d.%m.%Y_%H:%M:%S_%P"`.'_screencast.mp4' | |
input_width=320 # preselect width an height of video source | |
input_height=240 # other possible combinations: 640/480; 320/240 | |
ASPECT=43 # '169' (16:9) or '43' (4:3); this value affects video playback with mplayer or vlc only! | |
V_NORM="pal" # preselect TV-norm 'PAL' oder 'NTSC' | |
DEV_VIDEO="/dev/video0" | |
title="Select Recording Type" | |
INPUT=`zenity --width=710 --height=350 --title="$title" --list --radiolist --column="Choice" \ | |
--column="Mode" --column="Description" \ | |
TRUE "0" "Screen Recording + audio from default speakers" \ |
This file contains hidden or 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
fname=`date +"%d.%m.%Y_%H:%M:%S_%P"`.'_screencast.mp4' | |
input_width=320 # preselect width an height of video source | |
input_height=240 # other possible combinations: 640/480; 320/240 | |
ASPECT=43 # '169' (16:9) or '43' (4:3); this value affects video playback with mplayer or vlc only! | |
V_NORM="pal" # preselect TV-norm 'PAL' oder 'NTSC' | |
DEV_VIDEO="/dev/video0" | |
zenity --question --text "Record Webcam video(if NO, Screencast only)?" | |
if [ "$?" != 0 ]; then #1 | |
vlc screen:// :screen-fps=20 :screen-follow-mouse :live-caching=300 :input-slave=alsa://hw:1,0 :sout="#transcode{vcodec=h264,vb=384,fps=5,acodec=mpga}:duplicate{dst=std{mux=mp4,access=file,dst='$fname'}}" & |
This file contains hidden or 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
#######settings########## | |
#select which site to download from | |
wallhaven=0 | |
imgur=1 | |
#seclect term/blog to search. | |
wallhavenSearchTerm=Minimalist | |
imgurSearchBlog=aGWwf | |
#set purity level | |
purityLevel=110 | |
#set wallpaper change and download time |
This file contains hidden or 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 bash | |
s=$(date +%s | cut -b1-13) | |
while true | |
do | |
export DISPLAY=:0.0 | |
battery_percent=$(acpi -b | grep -P -o '[0-9]+(?=%)') | |
if on_ac_power; then | |
if [ "$battery_percent" -gt 90 ]; then | |
s=$(date +%s | cut -b1-13) | |
notify-send -i notification-power-disconnected -t 6000 "Battery full." "Level: ${battery_percent}% " |