Skip to content

Instantly share code, notes, and snippets.

@Lyrain
Lyrain / duck
Last active July 10, 2019 11:25
Open a duckduckgo search from the Command Line
#!/bin/sh
if [ $# -ge 1 ]; then
QUERY=$(echo "$@" | sed -e "s/ /+/g")
LINK="https://duckduckgo.com/?q=$QUERY"
open -a Firefox $LINK
else
echo "Duck needs a search query. Usage: duck foo bar baz"
fi
@Lyrain
Lyrain / subnet.py
Created February 27, 2017 12:56
Script to "cheat" at sub-netting.
#!/usr/local/bin/python3
import sys
import ipaddress as ip
def print_help():
print("Usage: ")
print("main.py address [computers]\n")
print("address: must be an IPv4 network address (including netmask in shorthand e.g. 192.168.211.0/27)")
print("computers: optional - Number of computers on subnet. Will only print first and last host address.")