Skip to content

Instantly share code, notes, and snippets.

View patbl's full-sized avatar

Patrick Brinich-Langlois patbl

  • Academia.edu
  • Berkeley, California
View GitHub Profile
@patbl
patbl / add_custom_tag_groups.rb
Last active November 5, 2022 15:38
Script to add custom tag groups to all StatsD-reported Datadog metrics. Don't run it unless you understand what it does. Tags in `TAGS_TO_EXCLUDE` are excluded from the custom tag groups.
# frozen_string_literal: true
require 'datadog_api_client'
require 'json'
class AddCustomTagGroups
ALL_METRICS_FILE = "metrics.txt"
METRIC_TYPES_FILE = "metric_types.json"
METRIC_TAGS_FILE = "metric_tags.json"
TAGS_TO_EXCLUDE = [
name: academia
root: ~/
on_project_start: ssh-add ~/.ssh/id_rsa
startup_window: host
windows:
- sync: sync_academia_app
- server:
layout: main-horizontal
coffeescript:
config_file: .coffeescript_style.json
scss:
config_file: .scss_style.yml
ruby:
config_file: .ruby_style.yml
javascript:
@patbl
patbl / gist:40acf3d438303b9e979c
Created January 23, 2016 05:32
merge! profile
require 'ruby-prof'
MODES = [
RubyProf::WALL_TIME,
RubyProf::PROCESS_TIME,
RubyProf::CPU_TIME,
RubyProf::ALLOCATIONS,
RubyProf::MEMORY,
RubyProf::GC_TIME,
RubyProf::GC_RUNS,
coffeescript:
config_file: .coffeescript_style.json
scss:
config_file: .scss_style.yml
ruby:
enabled: .ruby-style.yml
javascript:
AllCops:
Exclude:
- "vendor/**/*"
- "public/**/*"
- "tmp/**/*"
- "db/schema.rb"
UseCache: false
Style/AccessModifierIndentation:
Description: Check indentation of private/protected visibility modifiers.
@patbl
patbl / switch-to-emacs
Created August 21, 2013 16:37
Window switcher
#!/bin/bash
win_class='emacs.Emacs'
# get list of all windows matching with the class above
win_list=$(wmctrl -x -l | grep -i $win_class | awk '{print $1}' )
# get id of the focused window
active_win_id=$(xprop -root | grep '^_NET_ACTIVE_W' | awk -F'# 0x' '{print $2}')
if [ "$active_win_id" == "0" ]; then
active_win_id=""
require 'test/unit'
def combine_anagrams(words)
end
class TestCombineAnagrams < Test::Unit::TestCase
@input = %w[cars for potatoes racs four scar creams scream]
@output = [ ['cars', 'racs', 'scar'],
['four'],
['for'],