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
def timestables(size): | |
table = [[0 for i in range(size)] for i in range(size)] | |
for j in range(size): | |
for i in range(size): | |
table[j][i] = (i+1)*(j+1) | |
table[i][j] = (i+1)*(j+1) | |
for line in table: | |
print line | |
timestables(15) |
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
screenshot="$1" | |
client_id="" # get your clientid here: https://api.imgur.com/oauth2/addclient | |
response=$(curl -silent -H "Authorization: Client-ID $client_id" -F "image=@${screenshot}" https://api.imgur.com/3/image.json) | |
url=$(echo $response | awk '{split($0,a,","); print a[48]}' | sed 's/\(\\\|"link":\|}\|"\)//g') | |
deletehash=$(echo $response | awk '{split($0,a,","); print a[46]}' | sed 's/\("deletehash":\|"\)//g') | |
echo "$url" | xclip -selection c # needs xclip installed, available most linux distros | |
echo "$url" | |
echo "deletion page: http://imgur.com/api/delete/${deletehash}" |
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
#!/bin/bash | |
# run this by sourcing it, i.e. "source aur -x" or ". aur -r" | |
# you can make it easier on yourself by making a alias | |
# for example, alias aurhelper="source /path/to/aurhelper.sh" | |
src_dir="/home/user/aur_packages/src/" # change these to whatever you'd like | |
bin_dir="/home/user/aur_packages/bin" | |
case "$1" in |
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
#!/bin/bash | |
# The output is similar to what you'd see by simply running pacman -Ss "search term" | |
# but each package name is prepended with a number. If you wish to install any of the | |
# packages after making a search, you simply enter in the number of the package, otherwise | |
# q to quit. Once you select which package to install, pacman -S is run and will ask for your | |
# password and confirm if you really wish to install the package. | |
search_term="$1" |
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
#!/bin/bash | |
# iso2usb is a simple script for OSX to ease the conversion of an iso to an img file | |
# and then dd that img file to a USB of your choosing. You simply give it the iso | |
# as a parameter and then the disk number and it will take care of the rest. | |
# based on the commands here: http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-mac-osx | |
# and the color commands here: http://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux | |
# exits out of the script upon error |
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
#!/bin/bash | |
# run this by sourcing it, i.e. "source lfs -t" or ". lfs -t" | |
# you can make it easier on yourself by making an alias | |
# for example, alias lfs="source /path/to/lfs.sh" | |
# colors to use within the script | |
BLACK='\033[0;30m' | |
DGRAY='\033[1;30m' |
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
# this was initially designed for cinnamon, but cinnamon in its latest update offers this "out of the box" | |
export DISPLAY=:0.0 | |
charge=$(cat /sys/class/power_supply/BAT1/capacity) | |
status=$(cat /sys/class/power_supply/BAT1/status) | |
if [[ $status != "Charging" ]]; then | |
if [[ $charge < 20 ]]; then | |
notify-send "Charge now is at $charge%" "Plug it in now!" --icon=dialog-warning | |
elif [[ $charge < 10 ]]; then |
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
# -*- coding: utf-8 -*- | |
#!/user/bin/python | |
from gi.repository import Notify; import json; import urllib2; import sys | |
reload(sys); sys.setdefaultencoding("utf-8") | |
city_name = "Insert City Name Here" | |
city_data = json.load(urllib2.urlopen("http://api.openweathermap.org/data/2.5/weather?q="+city_name)) | |
city_temp = str(city_data['main']['temp']-273.15) | |
city_weather = city_data['weather'][0]['description'] |
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
# NOTE: As of the Linux kernel version 4.2.3, | |
# the keyboard works out of the box and this is no longer required | |
keycode 8 = | |
keycode 9 = Escape NoSymbol Escape | |
keycode 10 = 1 exclam 1 exclam | |
keycode 11 = 2 at 2 at | |
keycode 12 = 3 numbersign 3 numbersign | |
keycode 13 = 4 dollar 4 dollar | |
keycode 14 = 5 percent 5 percent | |
keycode 15 = 6 asciicircum 6 asciicircum |
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 dropbox | |
import time | |
import os | |
APP_KEY = '' | |
APP_SECRET = '' | |
ACCESS_TOKEN = "" | |
TIMESTAMP = time.strftime('%Y-%m-%d') | |
FILENAME = "filename.sql" |