Skip to content

Instantly share code, notes, and snippets.

View whalesalad's full-sized avatar
🐟
i've seen more spine in jellyfish

Michael Whalen whalesalad

🐟
i've seen more spine in jellyfish
View GitHub Profile
@whalesalad
whalesalad / .psqlrc
Created October 26, 2016 14:14
~/.psqlrc
\timing
\set PROMPT1 '%[%033[33;1m%]%x%[%033[0m%]%[%033[1m%]%/%[%033[0m%] %m %R%# '
\pset null 'NULL'
\pset border 2
\x auto
\set HISTCONTROL ignoredups
\set COMP_KEYWORD_CASE upper
@whalesalad
whalesalad / ipmi_tool_fanspeed_r720.sh
Created June 11, 2020 18:23
ipmi_tool_fanspeed_r720.sh
brew install ipmitool
export IPMI_PASSWD="••••••••••••"
# List sensors
ipmitool \
-I lanplus \
-H thor-drac.ws.internal \
-U root \
-P $IPMI_PASSWD \
Bundler/OrderedGems:
Enabled: false
Bundler/SymbolArray:
Enabled: false
Layout/IndentationWidth:
Enabled: false
Layout/ElseAlignment:
defmodule Rabbit.Ublox do
alias __MODULE__
use Bitwise
defstruct msg_class: nil,
msg_id: nil,
payload: []
def list_to_binary(list) do
Enum.into(list, <<>>, fn byte -> <<byte::8>> end)
import io
import json
from service.memcached import client as memcached
from service.storage import utils
ONE_MEGABYTE = 1000 * 1000
@whalesalad
whalesalad / views.py
Last active May 28, 2019 09:13
Doing Server-Side Events with Django (hint: it's easy)
import redis
from django.conf import settings
from django.http import StreamingHttpResponse as HttpResponse
def new_connection():
"""
At some point this will evolve into using a connection pool,
but for now it opens a new connection for each user.
@whalesalad
whalesalad / supycache_redis.py
Created April 8, 2019 02:22
work in progress!
import pickle
import supycache
from supycache.backends.base import BaseCache
from service.persistence import Redis
class SupyCacheRedisBackend(BaseCache):
def __init__(self, conn, prefix=None, config=None):
{
"assignments": {
"spl.user_overview.pilot": "control",
"IDPAXAccountRecoveryCopy": "two",
"DaxDwlTemplateDecisionIntegration": "treatment",
"dax_acq.dwl_email_first_reduced.DAXDwlEmailFirstReduced": "control",
"webclient.brochure_experiments.showRequestLyft": "treatment",
"webclient.welcome_redirect.FPRedirectDesktopWelcomeToRideLyft": "control",
"organic_growth.gift_card_footer.display_footer": "treatment",
"webclient.ride_request_flow.PGShowCreditCardModal": "treatment",
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
import copy
import itertools
base_policy = json.loads("""
{
{
"query": "<%= params[:query] %>",
"suggestions": [
<% size = @customers.size %>
<% @customers.each_with_index do |customer, i| %>
{
"value": "<%= customer.id %>",
"data": <%= raw customer._source.to_json %>
}<%= i + 1 == size ? "" : "," %>
<% end %>