This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
This file contains hidden or 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 'faraday' | |
| require 'faraday_middleware' | |
| module Icecast | |
| class Admin < Faraday::Connection | |
| class Error < RuntimeError | |
| end | |
| class AdminError < Error | |
| end |
This file contains hidden or 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
| # Description: | |
| # Get help from @yourorg/it for your information technology problems. Oh by the way.... Your Welcome. | |
| # | |
| # Commands: | |
| # hubot it me <problem> - get help from @yourorg/it about your information technology <problem> | |
| module.exports = (robot) -> | |
| robot.respond /it(?: me)?(?: (.*))?/i, (msg) -> | |
| problem = msg.match[1] |
This file contains hidden or 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
| #!/bin/bash | |
| set -e | |
| for opt in $* ; do | |
| case "$opt" in | |
| --debug) hubot_debug="coffee --nodejs --debug";; | |
| esac | |
| done |
This file contains hidden or 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
| def flaky_code() | |
| unless @flaky_code_works | |
| @flaky_code_works = true | |
| raise 'wtf' | |
| end | |
| puts "works eventually lol" | |
| end |
This file contains hidden or 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
| class PostsController < ApplicationController | |
| if ENV['HTTP_AUTH_USERNAME'].present? && ENV['HTTP_AUTH_PASSWORD'].present? | |
| http_basic_authenticate_with name: ENV['HTTP_AUTH_USERNAME'], password: ENV['HTTP_AUTH_PASSWORD'] | |
| def index | |
| render plain: "Everyone can see me!" | |
| end | |
| end |
This file contains hidden or 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
| module.exports = (robot) -> | |
| robot.error (err, msg) -> | |
| robot.logger.error "#{err}\n#{err.stack}" | |
| if msg? | |
| msg.reply "#{err}\n#{err.stack}" |