Skip to content

Instantly share code, notes, and snippets.

@switzer
switzer / gist:710e3631c1d319e246129e16b6e42067
Created March 14, 2018 14:26
Pull CoinMarketCap data into a CSV
curl https://api.coinmarketcap.com/v1/ticker/?limit=0 | jq -r '.[] | [."id", ."name", ."symbol", ."rank", ."price_usd", ."price_btc", ."24h_volume_usd", ."market_cap_usd", ."available_supply", ."total_supply", ."max_supply", ."percent_change_1h", ."percent_change_24h", ."percent_change_7d", ."last_updated"] | @csv' > coinmarketcap_$(date '+%Y%m%d%H%M%S').csv
@switzer
switzer / AUTHENTICATED_TAG.md
Last active August 29, 2015 14:14
Documentation on how to add Authenticated Digital tags to your ad creative

Authenticated Ad Tags

Please append the following script immediately after your ad creative iframe/javascript tag in your ad system:

<script data-adjs='true' data-client-id='<<account_id>>' type='text/javascript' src='//cdn.adjs.net/auth.digital.js'></script>

NOTE: <<account_id>> is your Authenticated Digital account id. For example, the AD demo account ID is: f4bb22d31b2e2357f5375465ead279c90915fbe1

Inserting Macros

@switzer
switzer / gist:8792691
Last active August 29, 2015 13:56
Inherited switzer/redis Dockerfile
FROM switzer/redis
MAINTAINER Scott Switzer <[email protected]>
RUN cp /usr/src/redis-$REDIS_VERSION/redis.conf /etc
RUN sed -i "s/port 6379/port 0/" /etc/redis.conf;\
sed -i "s/# unixsocket \/tmp\/redis.sock/unixsocket \/tmp\/redis.sock/" /etc/redis.conf;\
sed -i "s/# unixsocketperm 755/unixsocketperm 777/" /etc/redis.conf;\
sed -i "s/# slaveof <masterip> <masterport>/slaveof admin-cache.internal.sunblock.io 6379/" /etc/redis.conf
init_config:
instances:
- host: localhost
sock: /tmp/redis.sock
password:
tags:
- optional_tag1
- optional_tag2
@switzer
switzer / gist:5612958
Created May 20, 2013 15:28
luuid fail on mac
$ brew list
autoconf automake libtool mongodb node readline
$ brew install luarocks
==> Installing luarocks dependency: lua
==> Downloading http://www.lua.org/ftp/lua-5.1.5.tar.gz
Already downloaded: /Library/Caches/Homebrew/lua-5.1.5.tar.gz
==> Patching
patching file Makefile
@switzer
switzer / Login and Get curl requests
Created January 22, 2013 03:38
Cannot get second Passport authentication (when not calling /login) to work.
$ curl -i --data "[email protected]&password=password" http://localhost:3000/login
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 260
Set-Cookie: connect.sid=s%3A9b4c4dMSkSiSEex%2BOgtsXBsu.BUoXyrHk95nvhAfDY3mkOIuk0I8npOhdAzMCc4WHnsA; Path=/; HttpOnly
Date: Tue, 22 Jan 2013 03:32:13 GMT
Connection: keep-alive
{
orgSchema.path('timezone').validate(function(value) {
Timezone.findOne({_id: value}, "_id", function (err, timezone) { return false; });
}, "Please provide a valid timezone");
var Post = function(db) {
this.db = db;
};
Post.prototype.get = function(req, res) {
var id = req.params.id;
var org = req.params.org;
var db = this.db;
console.log('Retrieving post: ' + id + ' from org: ' + org);
@switzer
switzer / gist:4218526
Created December 5, 2012 19:03
Custom Mongodb Serializer/Deserializer
package com.example.core.application
import com.mongodb.casbah.Imports._
import java.util.UUID
import com.example.domain.{User, Address, Customer}
/**
* Contains type classes that deserialize records from Casbah into "our" types.
*/
trait CasbahDeserializers {
@switzer
switzer / gist:4218450
Created December 5, 2012 18:57
Customer Serializer
implicit object CustomerSerializer extends CasbahSerializer[Customer] {
def apply(customer: Customer) = {
val builder = MongoDBObject.newBuilder
System.out.println("CustomerSerializer:::" + customer)
builder += "firstName" -> customer.firstName
builder += "lastName" -> customer.lastName
builder += "email" -> customer.email
builder += "addresses" -> customer.addresses.map(AddressSerializer(_))
builder += "id" -> customer.id