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
# SNAKES GAME | |
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting | |
import curses | |
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN | |
from random import randint | |
curses.initscr() | |
win = curses.newwin(20, 60, 0, 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
# SNAKES GAME | |
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting | |
import curses | |
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN | |
from random import randint | |
curses.initscr() | |
win = curses.newwin(20, 60, 0, 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 curses | |
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN | |
import random | |
from random import randrange, randint | |
class Box: | |
pass | |
def Game(pos_x, pos_y, size): |
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/python | |
import curses | |
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN | |
import random | |
from random import randrange, randint | |
def printRobot(win, pos_x, pos_y, size): | |
''' Prints the Robot ''' | |
for i in range(size): |
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/local/bin/python3.2 | |
# Moves files from multiple directories to one, and renames them if necessary. | |
# WHEN IS THIS SCRIPT USEFUL: | |
# If you have files in multiple directories, say ABC, ABC-1, ABC-2, | |
# then all the files from the directores will be moved to directory ABC | |
# and the other directories would be removed. | |
# If a file with that name already exists, it will be renamed and then moved. | |
# Renaming: <filename> ==> ABC--<filename>--<some_number> |
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 | |
while true | |
do | |
chargingState=$(grep "charging state:" /proc/acpi/battery/BAT0/state | awk '{print $3}') | |
batteryFull=$(grep "design capacity:" /proc/acpi/battery/BAT0/info | awk '{print $3}') | |
batteryRemaining=$(grep "remaining capacity:" /proc/acpi/battery/BAT0/state | awk '{print $3}') | |
batteryPercentage=$((batteryRemaining * 100/batteryFull)) |
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 | |
filename="$1" | |
echo -n "Enter the command name: " | |
commandName="" | |
while [ -z "$commandName" ]; | |
do | |
read commandName | |
done |
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
_is() | |
{ | |
local cur prev opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
if [[ ${cur} == * ]]; then | |
COMPREPLY=( $(find ./ -maxdepth 1 -iname "*${cur}*" | cut -d '/' -f 2) ) | |
return 0 |