Skip to content

Instantly share code, notes, and snippets.

View D3MZ's full-sized avatar
😎

Demetrius Michael D3MZ

😎
View GitHub Profile
@D3MZ
D3MZ / scraping_ruby_tapas.rb
Created August 1, 2013 21:19
unnecessarily complicated, but W/E.
require 'mechanize'
require 'pp'
require 'logger'
require 'pry'
require 'youtube_it'
#This is a great lesson of overcoding, I started with RubyTapas's boiler plate code thinking it'll be faster to code
#on top of his own stuff. But it ended up being overkill and terribly verbose.
#Abstracting the session is not necessary in this case and a terrible amount of overhead for a simple script.
#Especially when I use "click" on Mechanize::Link class. Which uses the same fucking session anyway!
require 'httparty'
require 'pp'
API_KEY = 'string'
#outputs filesize in bytes
module StreetView
include HTTParty
def self.image location
File.open(ENV['HOME']+"/#{location}.jpeg", 'w') { |file| file.write get('http://maps.googleapis.com/maps/api/streetview', :query => {:size => '1200x1200', :location => location, key: API_KEY, sensor: false}) }
@D3MZ
D3MZ / etsy.rb
Created September 10, 2013 15:40
%w{csv mechanize pp mongo peach parallel}.each { |x| require x }
include Mongo
@coll = MongoClient.new("localhost", 27017)['etsy']['stores']
def extracted url
@agent = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' } #resets cookies, prevent some tracking
page = @agent.get url
cut -d',' -f6 #Close prices in sheet
awk 'NR>1{print $1-p} {p=$1}' #changes in close prices
awk '{if ($1 != 0) print $1}' #no zeros
perl -ne 'print $_ < 0 ? -1 : 1, "\n";' #up-down format
.NET Compact Framework
.NET Framework
.NET Remoting
.NET for Web
1ShoppingCart
A/B Testing
A2Billing
ADK
ADO.NET
@D3MZ
D3MZ / test.js
Created December 29, 2015 20:56
test
// Find all YouTube videos
var $allVideos = $("iframe[src^='//www.youtube.com']"),
// The element that is fluid width
$fluidEl = $("body");
// Figure out and save aspect ratio for each video
$allVideos.each(function() {
$(this)
@D3MZ
D3MZ / alice_contact_page.txt
Created May 9, 2016 19:17
Facebook event currently fires (correctly but will mis-fire if there are other pixels involved)
on_submit: "fbq('track', 'Lead');"
on_submit: "ga('send', 'event', 'Contact Page', 'Received Submission');"
on_sent_ok: "ga('send', 'event', 'Contact Page', 'Email Sent Successfully');"
#this won't work as a script as you'll get user prompts that you should read. Just run each line individually.
#this is a blend of what's found on google, but re-arranged into a faster deploy.
#via: https://www.howtogeek.com/276468/how-to-use-a-raspberry-pi-as-a-networked-time-machine-drive-for-your-mac/
#and: http://www.techradar.com/how-to/computing/how-to-make-a-mac-time-capsule-with-the-raspberry-pi-1319989
# On your mac, make sure the USB hard drive is HFS+ (The better filesystems are more annoying to work with on Mac), with the appropriate permissions.
# In terminal write: "chmod 777 /Volumes/Time\ Machine && ls -l /Volumes" (Replace "Time\ Machine" with whatever your drive is called)
# You can connect the drive to your pi now.
#update system
@D3MZ
D3MZ / gist:be07333969c3e9d4194ab74b9f25a471
Created March 27, 2017 22:20
Deep Neural Network Training Performance for
training loss at step 0: 5.18 (2017-03-26 23:00:12.958387)
training loss at step 10: 6.79 (2017-03-26 23:02:21.577157)
training loss at step 20: 3.92 (2017-03-26 23:04:36.139422)
training loss at step 30: 3.57 (2017-03-26 23:06:38.333611)
training loss at step 40: 5.11 (2017-03-26 23:08:37.515464)
training loss at step 50: 4.66 (2017-03-26 23:10:37.834948)
training loss at step 60: 3.52 (2017-03-26 23:12:37.144137)
training loss at step 70: 3.23 (2017-03-26 23:14:36.581871)
training loss at step 80: 3.22 (2017-03-26 23:16:36.372585)
training loss at step 90: 3.26 (2017-03-26 23:18:44.086892)
@D3MZ
D3MZ / gist:0edaf6e9bc4e2350687cb88d48fc4fd1
Last active March 27, 2017 22:22
Deep Neural Network Training Performance
Model Name: MacBook Pro
Model Identifier: MacBookPro10,1
Processor Name: Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 6 MB
Memory: 16 GB