Skip to content

Instantly share code, notes, and snippets.

View djfpaagman's full-sized avatar

Dennis Paagman djfpaagman

View GitHub Profile
@djfpaagman
djfpaagman / gist:1633165
Created January 18, 2012 14:10
Small script to find Twitter users based on names in database
# encoding: UTF-8
require 'twitter'
Twitter.configure do |config|
config.consumer_key = '......'
config.consumer_secret = '......'
config.oauth_token = '......'
config.oauth_token_secret = '......'
end
@djfpaagman
djfpaagman / gist:1640299
Created January 19, 2012 14:31
SharedCount example script
# encoding: UTF-8
require 'json'
require 'open-uri'
institutes.each do |institute|
begin
sharedcount = JSON(open("http://api.sharedcount.com/?url=http://www.#{institute[:website]}").read)
# Save your data here
@djfpaagman
djfpaagman / gist:1640611
Created January 19, 2012 15:31
Twitter example script
# encoding: UTF-8
require 'twitter'
Twitter.configure do |config|
config.consumer_key = '......'
config.consumer_secret = '......'
config.oauth_token = '......'
config.oauth_token_secret = '......'
end
@djfpaagman
djfpaagman / gist:1640647
Created January 19, 2012 15:40
Facebook example script
# encoding: UTF-8
require 'json'
institutes.each do |institute|
begin
unparsed = open("https://graph.facebook.com/#{institute[:facebook]}").read
unless unparsed == "false"
facebook = JSON(unparsed)
@djfpaagman
djfpaagman / find_twitter_users.rb
Created March 19, 2012 14:59
Automaticly find Twitter users
# encoding: UTF-8
require 'twitter'
Twitter.configure do |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end
[
{
"url": "https://api.github.com/repos/octocat/Hello-World/issues/1",
"html_url": "https://github.com/octocat/Hello-World/issues/1",
"number": 1347,
"state": "open",
"title": "Found a bug",
"body": "I'm having a problem with this.",
"user": {
"login": "octocat",
# Encoding: UTF-8
require 'thread'
queue = Queue.new
threads = []
20.times do
threads << Thread.new do
# loop until there are no more things to do
@djfpaagman
djfpaagman / app_server_checker.rb
Last active December 27, 2015 10:09
Small script to check the http status code of multiple app servers for a certain URL.
require 'open-uri'
require 'thread'
require 'benchmark'
# AppServerChecker checks the response for a specific URL on each app server.
# It does so by overwriting the Host header to the original hostname to trick
# the app server in serving the correct content. It also speeds up the check
# by creating a seperate thread for each request and outputs to stdout.
#
# Usage:
@djfpaagman
djfpaagman / gist:7784827
Created December 4, 2013 09:35
Change Vim Font Size Depending on Screen Size
" Set font size based on screen size. When vertical height is greater than 800
" (i.e. an external monitor is attached on a regular 13" MBP), use 18, else use 16.
if has('mac')
if system("osascript -e 'tell application \"Finder\" to get bounds of window of desktop' | cut -d ',' -f 4 | xargs") > 800
set guifont=Inconsolata\ for\ Powerline:h18
else
set guifont=Inconsolata\ for\ Powerline:h16
endif
endif

Keybase proof

I hereby claim:

  • I am djfpaagman on github.
  • I am dennispaagman (https://keybase.io/dennispaagman) on keybase.
  • I have a public key whose fingerprint is 91FF 93B4 655D BCF1 1D73 F03F 136A 1E06 9A5E 214F

To claim this, I am signing this object: