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
| // Source: https://stackoverflow.com/questions/29855908/c-unordered-set-of-vectors | |
| struct hashFunction { | |
| size_t operator() (const vector<int> &v) const { | |
| hash<int> hasher; | |
| size_t seed = 0; | |
| for (int i : v) { | |
| seed ^= hasher(i) + 0x9e3779b9 + | |
| (seed << 6) + (seed >> 2); | |
| } | |
| return seed; |
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
| /* | |
| * Print the binary representation of an integer (8, 16, 32, and 64). | |
| * Based on the answers from William Whyte and ideasman42 at stackoverflow: | |
| * https://stackoverflow.com/questions/111928/is-there-a-printf-converter-to-print-in-binary-format | |
| */ | |
| // 8-bit integer | |
| #define BYTE_TO_BINARY_PATTERN_INT8 "%c%c%c%c%c%c%c%c" | |
| #define BYTE_TO_BINARY_INT8(byte) \ | |
| ((byte) & 0x80 ? '1' : '0'), \ | |
| ((byte) & 0x40 ? '1' : '0'), \ |
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
| https://unix.stackexchange.com/questions/336845/how-to-view-the-size-of-the-binary-files-using-linux-command | |
| stat -c %s file.o#binary |
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
| """ | |
| Change the delimiter of a csv file. | |
| https://stackoverflow.com/questions/6630170/python-parse-csv-file-replace-commas-with-colons | |
| """ | |
| import csv | |
| def changeDelimiter(inputfile, inputdelimiter, outputfile, outputdelimiter): | |
| reader = csv.reader(open(inputfile, "r"), delimiter=inputdelimiter) | |
| writer = csv.writer(open(outputfile, 'w'), delimiter=outputdelimiter) | |
| writer.writerows(reader) |
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
| """ | |
| Plot the performance data from the ciphers. | |
| """ | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import csv | |
| import pandas as pd | |
| import sys, getopt |
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
| """ | |
| Get files from list command | |
| """ | |
| import os | |
| def readFile(file1, file2): | |
| with open(file1, "r") as file: | |
| with open(file2, "w") as w: | |
| for line in file: |
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/bash | |
| for link in $(find . -type l) | |
| do | |
| loc="$(dirname "$link")" | |
| dir="$(readlink "$link")" | |
| mv "$dir" "$loc" | |
| rm "$link" | |
| done |
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
| //https://www.linuxquestions.org/questions/programming-9/c-home-directory-379996/ | |
| #include <iostream> | |
| #include <string> | |
| #include <stdlib.h> | |
| using namespace std; | |
| int main(int argc, char **argv) | |
| { | |
| string homedir = getenv("HOME"); |
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
| # https://stackoverflow.com/questions/2792650/import-error-no-module-name-urllib2 | |
| # https://crondev.wordpress.com/2014/06/15/use-python-to-download-files-from-websites/ | |
| from urllib.request import urlopen | |
| from bs4 import BeautifulSoup | |
| root = 'url' # url of the page | |
| resp = urlopen(root + 'index.html') | |
| soup = BeautifulSoup(resp.read(), 'html.parser') | |
| links = soup.find_all('a') |