!!
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/python3 | |
from ftplib import FTP | |
import glob | |
from os import system, path, remove | |
from os.path import join | |
from datetime import datetime | |
import logging | |
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s') | |
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
; maps_caps_to_esc.ahk | |
; AutoHoyKey script to remap Caps lock to Escape key | |
; Double-click the file or run it directly from the | |
; command line to start the script in the background. | |
; To run the script on startup, place in the Startup directory | |
; by pressing `Windows Key + r` and running `shell:startup`. | |
Capslock::Esc |
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
# Simple user prompt | |
echo -n "Enter name: " | |
read name | |
echo $name | |
# Read with a prompt | |
read -p "Enter name: " name | |
echo $name | |
# If reading from current shell and not running a separate process, use -e |
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
# Specific number of iterations | |
for i in $(seq 1 10) | |
do | |
echo $i | |
done | |
# Specify list | |
for x in test.txt misc.txt other.txt | |
do | |
rm $x |
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
# See if last statement executed was successful | |
./runSomething | |
if [ $? -eq 0 ]; then | |
echo OK | |
else | |
echo FAIL | |
fi | |
# The return value can also be stored as a variable |
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
# Define a function | |
hello() { | |
echo "Hello, world!" | |
} | |
# Run the function | |
hello | |
# Using function arguments | |
hello() { |
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
# Specific number of iterations | |
for i in $(seq 1 10) | |
do | |
echo $i | |
done | |
# Specify list | |
for x in test.txt misc.txt other.txt | |
do | |
rm $x |
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
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root. Exiting" | |
exit 1 | |
fi |