Skip to content

Instantly share code, notes, and snippets.

@SavvyGuard
SavvyGuard / mac_os_mouse_browser.json
Created October 27, 2018 00:30
Karabiner complex modification to allow for mouse support in browser in Mac OS
{
"title": "Mac OS Mouse Browser",
"rules": [{
"description": "Use button 4 and 5 on Mac OS for browser",
"manipulators": [{
"type": "basic",
"from": {
"pointing_button": "button4"
},
"to": [{
@SavvyGuard
SavvyGuard / mopubvideoampsample
Last active August 29, 2015 14:16
sample app mopub videoamp test bidresponse
{
"ext": {
"vamp_uuid": "477ce014-c140-11e4-a189-123e43da4f5e"
},
"seatbid": [
{
"bid": [
{
"nurl": "http://vast.videoamp.com/vast/54f4eb6added912e45b3c9b2?price=${AUCTION_PRICE}&vamp_uuid=477ef9da-c140-11e4-a189-123e43da4f5e&ex=mpb&auction_id=${AUCTION_ID}",
"cid": "54f4eb6added912e45b3c9b2",
@SavvyGuard
SavvyGuard / samplebidrequest.json
Created February 12, 2015 23:43
sample bidrequest
{
"badv": [
"adjghajogh2iohwrgiofhjo.com"
],
"bcat": [
"Automotive",
"Gambling",
"Alcohol"
],
"id": "90f39442f6615a1e1f31e879771b9ef7",
@SavvyGuard
SavvyGuard / createplacement.sh
Last active August 29, 2015 14:15
create placement in api
curl http://0.0.0.0:3005/placements/api/1.0/create?apikey=pyroturtle -X POST -d '{"impressions": 6000, "geo_region": ["US-CA"], "device__browser": ["Chrome"], "device_os": ["Windows 7", "Windows 8", "Windows 8.1"], "campaign": "54be9b9cdcfad93307ef8b99", "bid": 10}' -H "Content-Type: application/json"
curl http://0.0.0.0:3005/placements/api/1.1/54be9b9cdcfad93307ef8b99/pacing?apikey=pyroturtle -X POST
curl http://0.0.0.0:3005/placements/api/1.1/54be9b9cdcfad93307ef8b99/pacing?apikey=pyroturtle -X PUT -d '{"thursday":{"cap":3000,"0":{"hour_cap":600,"minutes_active":[[0,60]]},"1":{"hour_cap":600,"minutes_active":[[0,60]]},"2":{"hour_cap":600,"minutes_active":[[0,60]]},"3":{"hour_cap":600,"minutes_active":[[0,60]]},"4":{"hour_cap":600,"minutes_active":[[0,60]]},"5":{"hour_cap":600,"minutes_active":[[0,60]]},"6":{"hour_cap":600,"minutes_active":[[0,60]]},"7":{"hour_cap":600,"minutes_active":[[0,60]]},"8":{"hour_cap":600,"minutes_active":[[0,60]]}}}' -H "Cont
@SavvyGuard
SavvyGuard / liverailrequester.py
Created January 9, 2015 23:54
Makes a bench of requests to liverail test endpoint on bidder for profiling
import requests
import json
data = {
"bcat": [
"IAB25",
"IAB7-39",
"IAB8-18",
"IAB8-5",
"IAB9-9"
@SavvyGuard
SavvyGuard / dwq.py
Last active August 29, 2015 14:10
Makes requests to the data warehouse and returns results in json
# /usr/bin/python
import subprocess
import argparse
import json
import datetime
@SavvyGuard
SavvyGuard / liverailtest.json
Last active August 29, 2015 14:07
LiveRail Test BidRequest
{
"id": "LR_544697890b8bb5.19955162",
"imp": [
{
"id": "1",
"video": {
"mimes": [
"video/mp4",
"video/x-flv",
"video/webm"
@SavvyGuard
SavvyGuard / pricedecrypt.py
Created August 20, 2014 21:28
openx price decryption
# The incoming encrypted price is unpadded websafe base64 encoded of length 38
# This is obtained from base64 encoding the encrypted price, and *then*
# websafe base64 encoding the already encoded encrypted price.
encrypted_price_base64_wsbase64 = 'SjpvRwAB4kB7jEpgW5IA8p73ew9ic6VZpFsPnA'
# We first add padding
encrypted_price_base64_wsbase64_padded = 'SjpvRwAB4kB7jEpgW5IA8p73ew9ic6VZpFsPnA=='
@SavvyGuard
SavvyGuard / ty_vs_fy_mortgage.py
Last active August 29, 2015 14:02
mortgage 15 vs 30 year
def total_saved(monthly_sum, total_years, ror):
year = 0
total_sum = 0
year_sum = monthly_sum*12
while year <= total_years:
year += 1
total_sum += year_sum
total_sum *= ror
return total_sum
@SavvyGuard
SavvyGuard / ExDict.py
Created September 11, 2013 20:19
Python dict as a class
class ExDict(dict):
"""
Extended Dictionary
"""
def __init__(self,*arg,**kw):
super( ExDict , self).__init__(*arg, **kw)
def __setattr__(self, k, v):
if k in self.keys():
self[k] = v