Skip to content

Instantly share code, notes, and snippets.

@jage
jage / Gemfile
Last active August 14, 2018 17:56
source "https://rubygems.org/"
gem "mastodon-api", git: "https://github.com/tootsuite/mastodon-api.git"
gem "nokogiri"
gem "twingly-url"
# Remember to set the environment variable key `TWINGLY_API_KEY`
require "net/http"
require "time"
require "rexml/document"
BASE_URL = "https://api.twingly.com/blog/livefeed/api/v5/GetData"
params = {
timestamp: (Time.now - 3600).utc.iso8601, # Start one hour ago
apikey: ENV["TWINGLY_API_KEY"], # API key to access Blog LiveFeed
}
@jage
jage / mac_pro_41_openbsd_60.txt
Created February 14, 2017 20:27
Mac Pro 4,1 running OpenBSD 6.0
OpenBSD 6.0 (GENERIC.MP) #2: Mon Oct 17 10:22:47 CEST 2016
[email protected]:/binpatchng/work-binpatch60-amd64/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 12856193024 (12260MB)
avail mem = 12462084096 (11884MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x7749f000 (149 entries)
bios0: vendor Apple Inc. version "MP41.88Z.0081.B07.0910130729" date 10/13/09
bios0: Apple Inc. MacPro4,1
@jage
jage / sentry_excluded_exception.rb
Last active October 27, 2016 10:22
Exclude exceptions from Sentry by extending the exception
require "raven"
module SentryExcludedException; end
Raven.configure do |config|
config.dsn = "http://public:secret@localhost/project-id"
# Module extensions to be ignored can't be specified as strings
config.excluded_exceptions = [SentryExcludedException]
end
@jage
jage / .ruby-version
Last active November 17, 2016 09:46
Benchmark how to look up a class from string in Ruby
2.3
@jage
jage / innodb-tables-to-alter.sql
Created October 19, 2016 15:30
InnoDB tables to run `ALTER TABLE ... FORCE` on after a MySQL 5.5 -> 5.6 upgrade
# Improved version of http://mysqlserverteam.com/upgrading-old-mysql-5-5-format-temporals-to-mysql-5-6-format-2/#comment-746
SELECT t.table_schema,t.table_name,c.column_name,c.column_type, iss.num_rows
FROM information_schema.tables t
INNER JOIN information_schema.columns c ON c.table_Schema = t.table_schema AND c.table_name = t.table_name
INNER JOIN information_schema.innodb_sys_tables ist ON ist.name = concat(t.table_schema,"/",t.table_name)
INNER JOIN information_schema.innodb_sys_columns isc ON isc.table_id = ist.table_id AND isc.name = c.column_name
INNER JOIN information_schema.innodb_sys_tablestats iss ON iss.name = concat(t.table_schema,"/",t.table_name)
WHERE t.engine = "innodb"
AND c.column_type IN ("time","timestamp","datetime")
AND isc.mtype = 6
$ ruby test.rb
4
3
2
1
0
@jage
jage / dmesg.txt
Created July 11, 2016 14:34
OpenBSD 5.9/amd64 Mac Pro 2009
OpenBSD 5.9 (GENERIC.MP) #1888: Fri Feb 26 01:20:19 MST 2016
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
RTC BIOS diagnostic error cd<clock_battery,ROM_cksum,fixed_disk,invalid_time>
real mem = 12856193024 (12260MB)
avail mem = 12462358528 (11885MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x7749f000 (149 entries)
bios0: vendor Apple Inc. version "MP41.88Z.0081.B07.0910130729" date 10/13/09
  • lein new app clojure-twingly-search-api
  • edit clojure-twingly-search-api/project.cli and add dependencies:
  :dependencies [
                  [org.clojure/clojure "1.8.0"],
                  [com.twingly/twingly-search-api-java "1.0.0"]
                ]
@jage
jage / office-dashboard-terminal.yml
Last active October 15, 2021 09:33
Ansible playbook to schedule display sleep (macOS/OS X)
---
- hosts: office-dashboard-terminal
become: yes
tasks:
- name: Ensure displays are up during office hours
cron:
name="Activate display"
minute="0"
hour="8"
weekday="1-5"