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
# Install Ruby 1.9.2 on OS 10.6 | |
# Uses RVM and homebrew | |
# Install RVM (if you haven't already) | |
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) | |
# Install homebrew (if you haven't already) | |
ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)" | |
# If you already had rvm installed (older versions only) |
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
# Run these commands | |
# Uses Homebrew install of libxml2 with Snow Leopard version of libxslt | |
brew install libxml2 | |
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.7/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.7/lib --with-xslt-lib=/usr/lib/libxslt.1.dylib |
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 raw_find(view, key) | |
url = URI::parse(CouchPotato::Config.database_name) | |
if key.is_a?(String) | |
http_client = Curl::Easy.new("#{url}/_design/advocacy_polygon/_view/#{EscapeUtils.escape_url(view)}?key=%22#{EscapeUtils.escape_url(key.to_s)}%22&reduce=false&include_docs=true") | |
elsif key.is_a?(Integer) | |
http_client = Curl::Easy.new("#{url}/_design/advocacy_polygon/_view/#{EscapeUtils.escape_url(view)}?key=#{EscapeUtils.escape_url(key.to_s)}&reduce=false&include_docs=true") | |
elsif key.is_a?(Range) | |
http_client = Curl::Easy.new("#{url}/_design/advocacy_polygon/_view/#{EscapeUtils.escape_url(view)}?startkey=#{EscapeUtils.escape_url(key.begin)}&endkey=#{EscapeUtils.escape_url(key.end)}&reduce=false&include_docs=true") | |
else | |
raise SyntaxError |
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 Array | |
def ^(ary) | |
return (ary | self) - (ary & self) | |
end | |
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
desc "Heroku Cron Task" | |
task :cron => :environment do | |
begin | |
Rake::Task["accounts:bill"].invoke | |
rescue | |
HoptoadNotifier.notify($!) | |
end | |
begin | |
Rake::Task["accounts:expire"].invoke |
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
desc "Heroku Cron Task" | |
task :cron => :environment do | |
Rake::Task["accounts:bill"].invoke | |
Rake::Task["accounts:expire"].invoke | |
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
<a href='http://youtube.com'> | |
<img src='http://mauriciogomes.com/share/kx_video.png'> | |
</a> |
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
# URL Matching | |
# Taken from Android: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.1_r1/android/util/Patterns.java#145 | |
GOOD_IRI_CHAR = /a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF/ | |
GOOD_GTLD_CHAR = /a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF/ | |
GTLD = /[#{GOOD_GTLD_CHAR}]{2,63}/ | |
IRI = /[#{GOOD_IRI_CHAR}]([#{GOOD_IRI_CHAR}\-]{0,61}[#{GOOD_IRI_CHAR}]){0,1}/ | |
HOST_NAME = /(#{IRI}\.)+#{GTLD}/ | |
IP_ADDRESS = /((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9]))/ | |
DOMAIN_NAME = /(#{HOST_NAME}|#{IP_ADDRESS})/ | |
WEB_URL_REGEX = /((?:(http|https|Http|Https|rtsp|Rtsp):\/\/(?:(?:[a-zA-Z0-9\$\-\_\.\+\!\*\'\(\)\,\;\?\&\=]|(?:\%[a-fA-F0-9]{2})){1,64}(?:\:(?:[a-zA-Z0-9\$\-\_\.\+\!\*\'\(\)\,\;\?\&\=]|(?:\%[a-fA-F0-9]{2})){1,25})?\@)?)?(?:#{DOMAIN_NAME})(?:\:\d{1,5})?)(\/(?:(?:[#{GOOD_IRI_CHAR}\;\/\?\:\@\&\=\#\~\-\.\+\ |
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 tensorflow as tf | |
print(tf.__version__) | |
class myCallback(tf.keras.callbacks.Callback): | |
def on_epoch_end(self, epoch, logs={}): | |
if(logs.get('loss')<0.4): | |
print("\nReached 60% accuracy so cancelling training!") | |
self.model.stop_training = True | |
callbacks = myCallback() |
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 tensorflow as tf | |
print(tf.__version__) | |
mnist = tf.keras.datasets.mnist | |
(training_images, training_labels), (test_images, test_labels) = mnist.load_data() | |
training_images=training_images.reshape(60000, 28, 28, 1) | |
training_images=training_images / 255.0 | |
test_images = test_images.reshape(10000, 28, 28, 1) | |
test_images=test_images/255.0 | |
model = tf.keras.models.Sequential([ | |
tf.keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=(28, 28, 1)), |
OlderNewer