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
{ | |
"loops": [ | |
{ | |
"slug": "armstrong-numbers", | |
"difficulty": 1 | |
}, | |
{ | |
"slug": "atbash-cipher", | |
"difficulty": 1 | |
}, |
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
def valid(puzzle): | |
m = [list(row) for row in puzzle.split('\n')] | |
for row in m: | |
counts = set() | |
for ch in row: | |
if ch in counts and '_' != ch: | |
return False | |
counts.add(ch) | |
for column in zip(*m): | |
counts = set() |
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
#!/bin/bash | |
# Custom bash prompt | |
# Usage: add `source set_prompt.sh` to your .bashrc | |
# Settings: 0 or 1 | |
DEBUG=0 | |
USE_16M_COLOR=1 | |
# lowercase: decimal | |
# uppercase: hexadecimal |
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
#!/usr/bin/env python | |
import argparse | |
import os | |
from glob import glob | |
from urllib.request import urlretrieve | |
from urllib.error import HTTPError | |
parser = argparse.ArgumentParser( | |
formatter_class=argparse.ArgumentDefaultsHelpFormatter |
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
#!/bin/sh | |
nmap -sVL 192.168.1.1-127 | | |
grep -v "for 192.168.1." | | |
grep -oP "(?<=for ).*" |
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 argparse | |
from itertools import chain | |
def get_parser_info(parser): | |
opts = {} | |
commands = {} | |
if parser._positionals and parser._positionals._actions: | |
for a in parser._positionals._actions: | |
if isinstance(a, argparse._StoreAction) and not a.option_strings: |
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
_ifconfig() | |
{ | |
local cur prev interfaces | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
case "${COMP_CWORD}" in | |
1) interfaces=$(ifconfig | grep -oP "^\w+") ;; | |
esac |
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
#!/usr/bin/env python | |
from __future__ import print_function | |
import argparse | |
import subprocess | |
import sys | |
parser = argparse.ArgumentParser( | |
prog='loop', | |
formatter_class=argparse.ArgumentDefaultsHelpFormatter | |
) |
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
# -*- coding: utf-8 -*- | |
# Uses Python 2.7 | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
import requests | |
import json |
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
#!/bin/bash | |
set -e | |
# CARD=1 | |
PROFILE_BASE=output:analog-stereo | |
DEVICE=usb-Generic_USB_Audio_200901010001-00 | |
CARD_NAME="alsa_card.${DEVICE}" | |
SINK_BASE="alsa_output.${DEVICE}.analog-stereo" | |
# Find card index |
OlderNewer