Skip to content

Instantly share code, notes, and snippets.

View jdennes's full-sized avatar

James Dennes jdennes

View GitHub Profile
auth_options = {
bearer_token_file: "/var/run/secrets/kubernetes.io/serviceaccount/token"
}
ssl_options = {
ca_file: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
}
control_client = Kubeclient::Client.new \
"https://kubernetes.default.svc",
@jdennes
jdennes / recognize-path.md
Last active January 21, 2021 20:56
Easily get Rails controller and action from a route

Easily get Rails controller and action from a route:

irb(main):001:0> Rails.application.routes.recognize_path "/github/github/issues", method: "GET"
=> {:controller=>"issues", :action=>"index", :user_id=>"github", :repository=>"github"}
@jdennes
jdennes / request.sh
Last active December 31, 2019 09:30
Most starred public repositories on GitHub.
curl -G https://api.github.com/search/repositories \
--data-urlencode "q=stars:>1000" \
--data-urlencode "sort=stars" \
--data-urlencode "order=desc" \
-H "Accept: application/vnd.github.preview"
@jdennes
jdennes / appengine_console.py
Created June 6, 2010 22:59
An interactive console for App Engine apps
#!/usr/bin/python
# An interactive console for App Engine apps
# Usage: ./appengine_console.py app_id [host]
import code
import getpass
import sys
sys.path.append("/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine")
@jdennes
jdennes / .gitignore
Created October 19, 2011 08:05
Prototype of a super-simple feedparser web service
.DS_Store
*.pyc
web
feedparser.py
sgmllib3.py
@jdennes
jdennes / buienradar-sparkline
Last active April 29, 2016 16:56
Example of how to pipe output from `script/scrape` provided by https://github.com/jdennes/buienalarm into `spark`
$ script/scrape enschede
===> Scraping Buienalarm.nl...
Projected rainfall for the next two hours in enschede:
18:40 - 0.05mm/hour (light)
18:45 - 0.05mm/hour (light)
18:50 - 0.09mm/hour (light)
18:55 - 0.11mm/hour (light)
19:00 - 0.13mm/hour (light)
@jdennes
jdennes / link-header.sh
Last active December 26, 2015 20:58
Demonstrate repository url by ID included in the pagination details in the Link header.
@jdennes
jdennes / CreateSendOAuthTest.java
Last active December 14, 2015 00:09
A Java application to demonstrate authenticating with the Campaign Monitor API using OAuth. Uses the createsend-java library as well as the Spark micro web framework (but could easily be adapted for use with any Java web application framework).
// Ensure you set the CREATESEND_CLIENT_ID, CREATESEND_CLIENT_SECRET,
// and CREATESEND_REDIRECT_URI environment variables for your registered
// OAuth application.
import static spark.Spark.*;
import spark.*;
import com.createsend.General;
import com.createsend.models.clients.ClientBasics;
import com.createsend.models.OAuthTokenDetails;
import com.createsend.util.AuthenticationDetails;
@jdennes
jdennes / createsend-oauth.php
Last active December 13, 2015 20:58
A PHP application to demonstrate authenticating with the Campaign Monitor API using OAuth. Uses the createsend-php library as well as the Slim PHP micro framework (but could easily be adapted for use with any PHP framework).
<?php
# 1. Ensure you have Slim installed and in your include path.
# 2. Ensure you have createsend-php installed and in your include path.
# 3. Set CREATESEND_CLIENT_ID, CREATESEND_CLIENT_SECRET,
# and CREATESEND_REDIRECT_URI environment variables for
# your registered OAuth application.
require 'createsend/csrest_general.php';
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
@jdennes
jdennes / Procfile
Last active December 12, 2015 10:48
Another example Flask application to demonstrate authenticating with the Campaign Monitor API using OAuth. This example only uses the createsend and Flask packages.
web: python app.py