This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"io" | |
"os" | |
"os/exec" | |
"github.com/creack/pty" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark/ips" | |
require "benchmark/memory" | |
require 'bundler' | |
class Bundler::Settings | |
def original(name) | |
key = key_for(name) | |
value = configs.values.map {|config| config[key] }.compact.first | |
converted_value(value, name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'action_controller' | |
require 'benchmark/ips' | |
require 'benchmark/memory' | |
puts "ActionPack.version = #{ActionPack.version}" | |
module Actions | |
def foo | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'benchmark/ips' | |
require 'benchmark/memory' | |
def original(name) | |
name.to_s.split(/-/).map {|s| s.capitalize }.join('-') | |
end | |
def string(name) | |
name.to_s.split('-').map {|s| s.capitalize }.join('-') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark/ips' | |
require 'stack_frames' | |
STACK_FRAMES_BUFFER = StackFrames::Buffer.new(500) | |
def recurse(n, &block) | |
if n > 0 | |
recurse(n - 1, &block) | |
else | |
yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using Sonic-Pi | |
samps = "/Users/technicalpickles/Dropbox/sonicpi-samples/" | |
##| use_bpm 120 | |
define :mario_waha do |options={}| | |
options ||= {} | |
sample samps, "mlpit_mario_waha.wav", options | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
assertions = {} | |
lines = `pmset -g assertions`.lines.map {|line| line.chomp } | |
lines.each do |line| | |
# pid 329(Slack): [0x00004c1d00058b13] 24:48:54 NoDisplaySleepAssertion named: "Electron" | |
if line =~ /pid (\d+)\((.*)\): \[.*\] (\d+:\d+:\d+) (\w+) named: \"(.*)\"/ | |
pid = $1.to_i | |
application = $2 | |
date = $3 | |
assertion_type = $4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/setup' | |
require 'faraday' | |
require 'typhoeus' | |
require 'typhoeus/adapters/faraday' | |
require 'pry' | |
conn = Faraday.new do |faraday| | |
faraday.adapter :typhoeus | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group: | |
living_room_lights: | |
name: Living Room Lights | |
entities: | |
- light.living_room_lamp | |
living_room: | |
name: Living Room | |
view: yes | |
entities: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from datetime import timedelta | |
from requests.exceptions import ConnectionError as ConnectError, \ | |
HTTPError, Timeout | |
from homeassistant.components.sensor import DOMAIN | |
from homeassistant.helpers import validate_config | |
from homeassistant.helpers.entity import Entity | |
from homeassistant.util import Throttle |
NewerOlder