Skip to content

Instantly share code, notes, and snippets.

View zph's full-sized avatar

Zander Hill zph

View GitHub Profile
@jkronz
jkronz / cat_fact.rb
Last active November 3, 2015 17:33
Cat Facts Slack Integration
class CatFact
def self.fact
response = Typhoeus.get("http://catfacts-api.appspot.com/api/facts")
JSON.parse(response.body)['facts'].first
end
end
# mail.example.com should be one of the results of a `dig +short mx example.com`
# Note that your provider might block all port 25.
# If STARTTLS header is missing or mangled, but https://starttls.info/ shows example.com as supporting STARTTLS,
# there might be a downgrade going on.
(echo EHLO foo ; sleep 3) | nc mail.example.com 25
@pnc
pnc / observer.md
Last active April 1, 2025 21:38
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@naveen
naveen / scrubs
Last active December 2, 2021 05:50
Scrubs: Your monthly notice to go through and disconnect unused applications across various services.
Your monthly notice to go through and disconnect unused applications across various services.
Twitter: https://twitter.com/settings/applications
Dropbox: https://www.dropbox.com/account/connected_apps
Facebook: https://www.facebook.com/settings?tab=applications
Google Apps: https://security.google.com/settings/security/permissions?pli=1
Google Ads: http://www.google.com/ads/preferences
Google Account: https://security.google.com/settings/security/secureaccount
Foursquare: https://foursquare.com/settings/connections
Instagram: https://instagram.com/accounts/manage_access
@joakimk
joakimk / README.md
Last active August 12, 2024 14:56
CircleCI elixir build example

This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.

We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.

It should be generic enough to work on any elixir app using mix.

If you have a elixir_buildpack.config, then enable that section in the build script to keep versions in sync!

2016-08-09: Updated to newer Erlang and Elixir and fixed curl command.

@JoostKiens
JoostKiens / _media-queries.less
Created June 16, 2014 14:59
Named Media queries, drop in for bootstrap
/**
* Named media queries based on Bootstrap variables
* Usage:
* .module {
* @media @lg { … }
* @media @md, @sm { … }
* @media @md-or-less { … }
* }
*
* @lg-or-more (=> 1200) - - -
@rewinfrey
rewinfrey / heredoc_remove_leading_whitespace.rb
Last active August 29, 2015 14:02
Simple example for removing leading whitespace with Ruby's heredoc operator
# This is not as sophisticated as ActiveSupport's `strip_heredoc`, but is the simplest solution for
# removing leading whitespace.
# For more nuanced whitespace removal, take a look at http://apidock.com/rails/String/strip_heredoc
puts "With leading whitespace:"
puts <<-TEST
This is a test.
To remove leading spaces.
From Ruby's heredoc operator.
TEST
#!/usr/bin/env bash
main() {
if [ ! -p .test-commands ]; then
mkfifo .test-commands
fi
while true; do
cmd=$(cat .test-commands)
if [[ $cmd == "" ]]; then
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@drpancake
drpancake / gist:9605830
Last active November 17, 2016 03:26
Manually long-polling the Atlas ATS API (Bayeux protocol)
# Requires the 'requests' module: http://docs.python-requests.org/en/latest/
import json
import requests
URL = 'https://data.atlasats.com:4000/api'
def bayeux_call(data):
headers = {'content-type': 'application/json'}
res = requests.post(URL, data=json.dumps(data), headers=headers, verify=False) # no SSL cert check