Skip to content

Instantly share code, notes, and snippets.

View SnacksOnAPlane's full-sized avatar

Richard Smiley SnacksOnAPlane

  • CallRail
  • Atlanta
View GitHub Profile
smiley@smiley-laptop:~/code/brawl-scrape$ cat go.py
#!/usr/bin/python
import nflgame
import ipdb
import time
CURRENT_YEAR = 2014
CURRENT_WEEK = 4
CURRENT_KIND = 'PRE'
@SnacksOnAPlane
SnacksOnAPlane / gist:04f5b7cb9508fc17e82a
Last active August 29, 2015 14:08
Setting up a pseudo-split VPN
N.B. This all assumes that you currently connect to the VPN through a VirtualBox Ubuntu machine. If you don't, no problem, but you're gonna have to make it work with whatever your setup is!
IN YOUR VBox VM
1. sudo apt-get install openconnect
2. Make an executable shell script in your home directory:
#!/bin/bash
openconnect -u yourusername_us https://myaccess.oraclevpn.com/
module CompaniesHelper
ALL_SUFFIXES = %w(organic paid local)
ALL_ENGINES = %w(google yahoo bing search)
def hour_options_for_select
@hour_options ||= (0..23).map do |n|
suffix = n >= 12 ? 'PM' : 'AM'
hour = n % 12
hour = 12 if hour.zero?
["#{hour} #{suffix}", n]
File.open("/tmp/ts1.csv","w") { |f| f.write(ClassificationModels::CallNet.generate_training_csv(TrainingSet.find(1).calls)) }
ids = IO.read("/tmp/ids.txt").split(",");
calls = Call.where(id: ids);
CSV.open("/tmp/export-scoring.csv", "wb") do |csv|
calls.each do |c|
c = c.decorate
csv << [ c.id, c.duration, c.recording_mp3.expiring_url(time=1.week).to_s, "https://app.callrail.com#{c.web_waveform_path('primary')}", "https://app.callrail.com#{c.web_waveform_path('secondary')}", c.start_time, c.network, c.company.id, c.company.name ]
end
end;
{
"item": 5000,
"min": {
"value": 0
},
"goal": {
"value": 100000
},
"max": {
"value": 120000
{
"item": [
{
"value": 2000,
"text": "Calls Scored Today"
}
]
}
import pexpect
from pexpect import pxssh
import pdb
def do_lines(ssh, lines):
for line in lines.split("\n"):
line = line.strip()
print(line)
ssh.sendline(line)
ssh.prompt(timeout=300)
@SnacksOnAPlane
SnacksOnAPlane / back_pop_call_invoice_items.rb
Last active April 19, 2017 17:53
back_pop_call_invoice_items.rb
Call.where(start_time: 1.month.ago..DateTime.now).each do |call|
unless InvoiceItem.exist?(billable: call)
call.sidekiq(queue: :manual).create_invoice_item
end
end
@SnacksOnAPlane
SnacksOnAPlane / new_zips.rb
Last active April 27, 2017 15:33
new zip codes
ZipCode.create(zip: '12179', latitude: 42.711440, longitude: -73.525561)
ZipCode.create(zip: '12593', latitude: 42.243991, longitude: -73.641076)
ZipCode.create(zip: '01133', latitude: 42.170731, longitude: -72.604842)
ZipCode.create(zip: '01195', latitude: 42.1029, longitude: -72.5921)