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
# Here's how the controller route and function look: | |
@app.route("/search_items", methods=["POST"]) | |
def search_items(): | |
search_terms = form.search.data | |
results = search(search_terms) # search is a function I've defined in another file and imported | |
return render_template("search_results.html", search_res=results) |
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
<!DOCTYPE html> | |
<!-- layout.html --> | |
<html> | |
<head> | |
</head> | |
<body> | |
<div class="container"> | |
<div id='nav'> | |
<a href='{{ url_for('index') }}'><img src="/static/images/monitor-head.png" width='60px' height='31px' alt='monitor-head' id='head-logo' /></a> | |
<ul id='nav-bar'> |
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 | |
# | |
# ssh into a machine and automatically set the background | |
# color of Mac OS X iTerm depending on the hostname. | |
# | |
# Installation: | |
# 1. Save this script to /your_script_location/ssh-host-color.sh | |
# 2. chmod 755 /your_script_location/ssh-host-color.sh | |
# 3. alias ssh=/your_script_location/ssh-host-color.sh (add this to .bash_profile) | |
# 4. Configure your host colors below. |
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
# Git branch in prompt | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ " | |
HISTFILESIZE=5000 | |
alias ssh=~/dev/Scripts/ssh-host-color.sh |
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
require 'elasticsearch' | |
# defaults to "localhost" | |
client = Elasticsearch::Client.new log: true | |
SCHEDULER.every '5s', :first_in => 0 do |job| | |
health = client.cluster.health | |
send_event('es_health', {value: health['status']}) | |
end |
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
# Bash Prompt Color Variables | |
blu="\[\033[34m\]" | |
cyn="\[\033[36m\]" | |
grn="\[\033[32m\]" | |
yel="\[\033[33m\]" | |
red="\[\033[31m\]" | |
pur="\[\033[35m\]" | |
gry="\[\033[37m\]" | |
end="\[\033[00m\]" |
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
/***************************************************************** | |
Phant_Ethernet.ino | |
Post data to SparkFun's data stream server system (phant) using | |
an Arduino and an Ethernet Shield. | |
Jim Lindblom @ SparkFun Electronics | |
Original Creation Date: July 3, 2014 | |
This sketch uses an Arduino Uno to POST sensor readings to | |
SparkFun's data logging streams (http://data.sparkfun.com). A post | |
will be initiated whenever pin 3 is connected to ground. |
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 | |
# Pick a random mac voice out of the list below, and then pick a random action to say. | |
voices=( | |
Alex | |
Bells | |
Bruce | |
Cellos | |
Daniel | |
Fiona |
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
<!-- | |
To use this plist file, edit the string (name), and save it to ~/Library/LaunchAgents. | |
Make sure the file is owned by root. To start the plist, enter the following commands: | |
sudo launchctl load com.mercmotivator.cron.plist | |
And you're done! The plist will now run autmatically every 30 minutes, unless you decide | |
to change the time interval. | |
--> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> |
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
package main | |
import ( | |
"fmt" | |
) | |
func appendUnique(list []string) []string { | |
// initialize a map of string keys and boolean values for | |
// keeping track of list entries we've seen. | |
uniqueKeys := make(map[string]bool) |
OlderNewer