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
{% assign user_code_str = event.user.user_code | downcase %} | |
{% capture user_code_length %}{{user_code_str | size}}{% endcapture %} | |
{% capture zeros_missing %}{{'9' | minus: user_code_length}}{% endcapture %} | |
{% capture nine_digit_user_code %}{% for zero in zeros_missing %}0{% endfor %}{{event.user.user_code}}{% endcapture %} |
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
records = {('wendy', 'sanchez'): ['wunderkind','extraordinaire'], ('dan', 'black'): ['hacker','wannabe'], ('tim', 'black'): ['mad', 'genius', 'dontchaknow'], ('dan', 'garfield'): ['porg', 'rammer', 'snake charmer']} | |
sorted_last = ['black', 'black', 'garfield', 'sanchez'] | |
itered_records = [] | |
for last_name in sorted_last: | |
for key in records: | |
if key[1] == last_name: | |
if str([key + ('', records[key])]) not in itered_records: | |
itered_records.append(str([key + ('', records[key])])) | |
print key, records[key]` |
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
#aliases | |
alias rmdirectory='rm -rf' | |
alias ll='ls -artlhG' | |
alias get='curl -OL' | |
alias g='grep -i' | |
alias sublime='subl' | |
alias gl='git log' | |
alias gh='git log' | |
alias rmdir='rm -rf' |
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
# --------------------------------------------------------------------------- | |
# | |
# Description: This file holds all my BASH configurations and aliases | |
# | |
# Sections: | |
# 1. Environment Configuration | |
# 2. Make Terminal Better (remapping defaults and adding functionality) | |
# 3. File and Folder Management | |
# 4. Searching | |
# 5. Process Management |
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
from PIL import Image | |
filename = 'pastries.jpg' | |
image = Image.open(filename) | |
# get average color | |
# inspiration from https://gist.github.com/olooney/1246268 | |
def average_image_color(imagedata): | |
channel_histograms = {} | |
color_averages = {} |
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 | |
alias ll='ls -hartlG' | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
export PS1="🤖 \h\n👤 \u\n📁 \w\n🌳 \$(parse_git_branch)\n🤘 " |
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
# Polymer Mallard - Bash CRUD | |
# | |
# Put the following into your ~/.bash_rc or ~/.bash_profile | |
# Requires Python, cURL | |
function pmCrudRequest { | |
printf " \n \e[1;33m$method\e[0m from \e[1;33m$url\e[0m \n \n" | |
printf " \n \e[0;32m" | |
echo "$response" | python -m json.tool | |
printf "\e[0m" |
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
"""Tests for each individual function in the Client.""" | |
import responsysrest as r | |
def dict_contains_key(d, k): | |
"""Test if the key is in the dictionary.""" | |
return k in d | |
def test_get_context(): |
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
class_properties = ['foo', 'bar', 'baz'] | |
for prop in class_properties: | |
print(f''' | |
@property | |
def {prop}(self): | |
"""Get {prop}.""" | |
return self.__{prop} | |
@{prop}.setter |
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
# fix owner of files and folders recursively | |
sudo chown -vR $(whoami) /usr/local /opt/homebrew-cask /Library/Caches/Homebrew | |
# fix read/write permission of files and folders recursively | |
chmod -vR ug+rw /usr/local /opt/homebrew-cask /Library/Caches/Homebrew | |
# fix execute permission of folders recursively | |
find /usr/local /opt/homebrew-cask /Library/Caches/Homebrew -type d -exec chmod -v ug+x {} + |
OlderNewer