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
# [username@hostname ~/path (git branch)]$ | |
# [bluepurpleblue yellow orange]$ | |
# Outside []$ is green if previous command is successful (exit code = 0) and red otherwise | |
# Add https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh to your home directory | |
source ~/.git-prompt.sh | |
export PS1='$(exitcode=$?; if [[ $exitcode == 0 ]]; then printf "\[\e[32m\][\[\e[m\]"; else printf "\[\e[31m\][\[\e[m\]"; fi; printf "\[\e[34m\]\u\[\e[m\]\[\e[95m\]@\[\e[m\]\[\e[34m\]\h\[\e[m\] \[\e[33m\]\w\[\e[m\]\[\e[91m\]$(__git_ps1 " (%s)")\[\e[m\]"; if [[ $exitcode == 0 ]]; then printf "\[\e[32m\]]\$ \[\e[m\]"; else printf "\[\e[31m\]]\$ \[\e[m\]"; fi)' |
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 | |
#Bash script to go through multiple files looking for certain lines using regex (differing between files) | |
#and replacing it with the correct corresponding text (different for each file), grabbed from a list in an external file | |
#Expects to be placed in the same directory as the files to search through | |
#Relies on 2 external files; a list of filenames to edit, and the corresponding replacement text for each file (separated by newlines) | |
#Used to escape any problematic characters in the replacement text | |
escapeCharacter() #Takes 2 arguments, the character to escape and the text to escape it from |
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 libraries | |
import requests | |
import time | |
#declare variables | |
#open weather map's endpoint | |
URL = "http://api.openweathermap.org/data/2.5/weather?q=" | |
#the authorisation key | |
KEY = "&APPID=9caeab719c222439d4a2747fc6591523" |
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 libraries | |
import requests | |
import RPi.GPIO as GPIO | |
import time | |
#declare variables | |
#open weather map's endpoint | |
URL = "http://api.openweathermap.org/data/2.5/weather?q=" | |
#the authorisation key |