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
| // Fahrenheit to Celsius | |
| // (F - 32) * (5/9) = C | |
| use std::io; | |
| fn main() { | |
| let mut input = String::new(); | |
| io::stdin().read_line(&mut input).unwrap(); |
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
| extern crate sqlite; | |
| use std::fs::File; | |
| use std::io::{BufRead, BufReader}; | |
| fn db_connection(db_name: &String) -> sqlite::Connection { | |
| let connection = sqlite::open(db_name).unwrap(); | |
| connection.execute("CREATE TABLE teas (name text, variety text, last_used date)").unwrap(); |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Maths Group - Negative Numbers</title> | |
| <style> | |
| .header-body { | |
| width: 100%; | |
| height: 100%; | |
| text-align: center; |
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 re | |
| from hypothesis import given, strategies as st | |
| EMAIL_REGEX = re.compile(r'[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+') | |
| def validate_email(email): | |
| """ Validates an email address""" | |
| if EMAIL_REGEX.match(email): |
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 json | |
| import sys | |
| import elasticsearch | |
| def send_to_es(payload, _id, list_name): | |
| es = elasticsearch.Elasticsearch() | |
| es.index(index=list_name, doc_type='item', id=_id, body=payload) | |
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 socket | |
| import subprocess | |
| import sys | |
| url = str(sys.argv[1]) | |
| remoteIp = socket.gethostbyname(url) | |
| print "Scanning " + url + " (" + remoteIp + ")" | |
| try: | |
| for port in range(1,5000): |
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 requests | |
| import os, sys | |
| url = sys.argv[1] | |
| dicts_dir = sys.argv[2] | |
| result_dir = sys.argv[3] | |
| def import_dict(dir, filepath): | |
| file = open(os.path.join(dir,filepath), 'r') | |
| return [item for item 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
| import requests, json, time, os | |
| ABS_URL = 'http://www.abs.gov.au/api/demography/populationprojection' | |
| def getData(): | |
| r = requests.get(ABS_URL) | |
| return json.loads(r.text) | |
| def getPopulation(): | |
| text = getData() |
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
| param ( | |
| [Parameter(Mandatory=$true)][string]$Hostname | |
| ) | |
| $failure = "" | |
| while (!$failure) { | |
| try { | |
| $net = [System.Net.Dns]::GetHostAddresses($Hostname) | |
| $Host.UI.RawUI.BackgroundColor = ($bckgrnd = 'DarkGreen') | |
| } catch [Exception] { | |
| $failure = "yes" |
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 os | |
| import copy | |
| from PIL import Image | |
| from pyPdf import PdfFileWriter, PdfFileReader | |
| def append_pdf(input,output): | |
| [output.addPage(input.getPage(page_num)) for page_num in range(input.numPages)] | |
| output = PdfFileWriter() | |
| cwd = os.getcwd() |