Skip to content

Instantly share code, notes, and snippets.

View winny-'s full-sized avatar
👋
***status goes here***

Winston (Winny) Weinert winny-

👋
***status goes here***
View GitHub Profile
function ssh_username_hostname() {
if [[ -n "$SSH_CONNECTION" ]]; then
echo "%{$fg_bold[yellow]%}%m "
fi
}
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
PROMPT='${ret_status}%{$fg_bold[green]%}%p $(ssh_username_hostname)%{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
@winny-
winny- / hi.md
Last active August 29, 2015 14:02

If you have an <a> element with attribute href set to an URI without the //, weird things happen…

  • Scheme is different from base URI's scheme.
  • Parsed as scheme followed by hostname.
@winny-
winny- / control_playback_in_skype_call.py
Last active August 29, 2015 14:03
Play/pause Hermes when in a skype call. See this issue for details on usage: https://github.com/HermesApp/Hermes/issues/183 remote.applescript is based off of: https://github.com/winny-/HermesRemote/blob/master/api/_scripts/status.applescript
#!/usr/bin/env python
import Skype4Py
import subprocess
import time
import sys
import argparse
@winny-
winny- / ken_wong_gallery_enchancement.js
Last active August 29, 2015 14:03
Ken Wong gallery enchancements
#!/usr/bin/env python
import dbus
def playpausepithos():
session_bus = dbus.SessionBus()
k = session_bus.get_object('net.kevinmehall.Pithos', '/net/kevinmehall/Pithos')
k.PlayPause()

0. yum update

yum update

1. create groups for sudo and ssh

groupadd --system sudo
groupadd --system ssh
#!/usr/bin/env python3
def duration_to_hours(duration):
if duration.isdigit():
# Default to minutes
return float(duration) / 60.0
def get_unit(unit):
nonlocal duration
if unit in duration:
@winny-
winny- / iplookup.py
Last active August 29, 2015 14:04
ipv4 only
#!/usr/bin/env python
import socket
import sys
def main(host):
exit_code = 0
try:
# This is a work-around for socket.gethostbyname() causing KeyboardInterrupt to be uncatchable.
# From: https://mail.python.org/pipermail/python-bugs-list/2007-July/039118.html
00000000 68 74 74 70 3a 2f 2f 67 6f 6f 67 6c 65 03 31 2c |http://google.1,|
00000010 31 2e 63 6f 6d 2f 0a |1.com/.|
00000017
#!/bin/sh
# Based off of https://superuser.com/questions/433316/check-a-list-of-domains-with-the-whois-command
while read domain; do
printf '%s ' "$domain" # This way we know what whois is currently looking up before it completes.
whois "$domain" | grep -qci 'No Match'
if [ $? -ne 0 ]; then echo "REGISTERED"; else echo "AVAILABLE"; fi
done