Skip to content

Instantly share code, notes, and snippets.

View pj4533's full-sized avatar

PJ Gray pj4533

View GitHub Profile
SELECT * from `state_boe_012219`
WHERE
(`state_boe_012219`.`CLEANED_VOTER_HISTORY` LIKE '%GE16%') AND
(`state_boe_012219`.`CLEANED_VOTER_HISTORY` LIKE '%GE18%') AND
(`state_boe_012219`.`CLEANED_VOTER_HISTORY` NOT LIKE '%GE17%')
UPDATE `state_boe_012219` SET `state_boe_012219`.`CLEANED_VOTER_HISTORY` = 'GE18GE17GE16PP16GE12GE10GE08PP08GE06GE05GE04GE03GE02' WHERE `state_boe_012219`.`COUNTYVRNUMBER` = '918273';
UPDATE `state_boe_012219` SET `state_boe_012219`.`CLEANED_VOTER_HISTORY` = 'GE18GE03GE02' WHERE `state_boe_012219`.`COUNTYVRNUMBER` = '817623';
SELECT
`state_boe_012219`.`COUNTYVRNUMBER`,
`state_boe_012219`.`VOTER_HISTORY`
FROM `state_boe_012219`
WHERE (`state_boe_012219`.`STATUS` = 'ACTIVE')
@pj4533
pj4533 / create_table.sql
Created April 8, 2019 17:04
Table structure for New York state Board of Elections data
CREATE TABLE `state_boe` (
`LASTNAME` varchar(255) DEFAULT NULL,
`FIRSTNAME` varchar(255) DEFAULT NULL,
`MIDDLENAME` varchar(255) DEFAULT NULL,
`NAMESUFFIX` varchar(255) DEFAULT NULL,
`RADDNUMBER` varchar(255) DEFAULT NULL,
`RHALFCODE` varchar(255) DEFAULT NULL,
`RAPARTMENT` varchar(255) DEFAULT NULL,
`RPREDIRECTION` varchar(255) DEFAULT NULL,
`RSTREETNAME` varchar(255) DEFAULT NULL,
@pj4533
pj4533 / lldbjson
Created May 22, 2018 12:47
lldb JSON helpers
command regex jo 's/(.+)/po print(String(data: try! JSONSerialization.data(withJSONObject: %1, options: .prettyPrinted), encoding: .utf8 )!)/'
command regex jobj 's/(.+)/po [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:%1 options:nil error:nil] encoding:nil]/'
@pj4533
pj4533 / travis_status.sh
Created May 9, 2018 12:49
Quick script to get status of a travis repo from the SVG link on the command line
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
html_data = open(ARGV[0]).read
@test = Nokogiri::HTML(html_data)
status_string = @test.xpath('//text').map.each.each { |i| i.inner_text }.last
color_code = 31 # red
@pj4533
pj4533 / travis_build.sh
Created May 8, 2018 12:53
Quick script to parse the travis YAML and build
#!/usr/bin/env ruby
require 'travis/yaml'
require 'open3'
content = File.read('.travis.yml')
Travis::Yaml.parse! content do |config|
cmd = "#{config[:script]}"
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
@pj4533
pj4533 / example_image_search.swift
Created March 22, 2018 13:39
Example reverse google image search to discogs lookup
func searchUsingImage(image: UIImage) {
if let imageData: NSData = UIImageJPEGRepresentation(image, 0.7) {
SVProgressHUD.showWithStatus("Searching...")
Alamofire.upload(
.POST,
"https://images.google.com/searchbyimage/upload",
multipartFormData: { multipartFormData in
multipartFormData.appendBodyPart(data: imageData, name: "encoded_image")
},
import UIKit
class Foo: NSObject {
struct Shared {
static var Instance: Foo = Foo()
}
}
@pj4533
pj4533 / lldbinit
Created March 7, 2013 13:46
lldbinit
command regex curlme 's/(.+)/po [TTTURLRequestFormatter cURLCommandFromURLRequest:%1]/'