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 re | |
def reg_index(reg_name): | |
return [ | |
'zero', # always zero (x0) | |
'ra', # return address | |
'sp', # stack pointer | |
'gp', # global pointer | |
'tp', # thread pointer | |
't0', |
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
if [ $# -eq 0 ]; then | |
PATH_DU="." | |
else | |
PATH_DU="$1" | |
fi | |
sudo du -ah --max-depth=1 $PATH_DU | sort -rh | head -n 30 |
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
##from nltk.corpus import brown | |
## | |
###tw = brown.tagged_words(tagset='universal') | |
##tw = brown.tagged_words() | |
## | |
##vbz = [t for t in tw if t[1] == "VBZ"] | |
##print('Total number of VBZ tokens:', len(vbz)) | |
## | |
##is_ = [t for t in tw if t[0] == "is"] | |
##print('Total number of "is" words:', len(is_)) |
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
# Python3 program which calculates final mark based on previous and potential future marks. | |
# How to use this program: | |
# - modify "previous_marks" list (line 18) | |
# - run the program | |
# If the program fails to run because of missing libraries, you can run the following command: | |
# python3 -m pip install matplotlib tk numpy | |
import matplotlib | |
matplotlib.use('TkAgg') | |
import matplotlib.pyplot as plt |
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
#python3 | |
# It's simpler version of the example posted at: | |
# https://www.geeksforgeeks.org/union-find/ | |
class Graph: | |
edges = set() | |
def add_edge(self, src, dst): | |
'''Each edge has 2 vertices: source and destination.''' |
NewerOlder