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
from ipaddress import ip_address | |
""" Two IP addresses are known """ | |
start = ip_address('192.168.1.0') | |
end = ip_address('192.168.1.254') | |
print("From {} to {}".format(start, end)) | |
for ip in range(int(start), int(end)): | |
print(ip_address(ip)) | |
""" Network address is known """ |
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/python | |
# -*- coding: utf-8 -*- | |
""" | |
Ecryption/Decryption REST Service | |
================================= | |
INSTALLATION | |
------------ |
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
CREATE KEYSPACE mail | |
WITH replication = { | |
'class': 'SimpleStrategy', | |
'replication_factor': 1 | |
}; | |
CREATE TABLE mailbox ( | |
box_id text, year int, | |
received timestamp, |
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
""" | |
Test validity of certificates. | |
Tested on Ubuntu with Python 3.5 and python3-openssl package. | |
""" | |
import ssl | |
from datetime import datetime | |
from warnings import warn |
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 string | |
from collections import Counter | |
george_takei_tweet = "When the media gave him millions in free air time, Trump loved them. Now when they do their job and ask questions, it's a global conspiracy." | |
tweet = george_takei_tweet.lower() | |
tweet = ''.join(ch for ch in tweet if ch not in set(string.punctuation)) | |
contains = Counter(tweet.split(' ')) | |
eval("contains['trump'] and contains['conspiracy']") | |
# ==> 1 |
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 | |
export COPYRIGHT="(c) 1967 J. Random User" | |
[ -d thumbs ] || mkdir thumbs & mogrify -format jpg -path thumbs -thumbnail 100x *.jpg | |
#mogrify -fill white -undercolor '#00000080' -gravity South -annotate +0+5 '$COPYRIGHT' *.jpg | |
for img in *.jpg; | |
do | |
#exif --ifd=0 --tag=0x010e --set-value='Holiday in Somewhere' -o $img $img | |
TITLE=$(exif -m --ifd=0 --tag=0x010e $img) |
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
INTERFACE=$(ifconfig en0 | grep 'inet ' | cut -f2 | awk '{ print $2}') | |
PUBLIC=$(curl -s http://ifconfig.co) | |
[ $INTERFACE = $PUBLIC ] || echo NAT |
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 sys | |
import argparse | |
from HTMLParser import HTMLParser | |
file_list = [] | |
class AssetFinder(HTMLParser): | |
def handle_starttag(self, tag, attrs): |
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
<html lang="en" > | |
<head> | |
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css"> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> | |
<style type="text/css"> | |
.location-item { padding: 0.5em; cursor: pointer; } | |
.level-2 { padding-left: 1.5em; } | |
.level-3 { padding-left: 2.5em; } | |
.level-4 { padding-left: 3.5em; } |
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
process.env.NODE_PATH || (process.env.NODE_PATH = __dirname) |