Skip to content

Instantly share code, notes, and snippets.

View thefotios's full-sized avatar
💭
definitely snacking

Fotios Lindiakos thefotios

💭
definitely snacking
View GitHub Profile

Backpopulation Time

@thefotios
thefotios / TCP Socket Availability.carbide.md
Last active August 25, 2016 20:10
TCP Socket Availability

TCP Socket Availability

@thefotios
thefotios / selenium-deploy.sh
Created September 28, 2011 14:37
Script to deploy selenium on Fedora machines
#!/bin/bash
#
# This script should allow for selenium to be run on a headless Fedora box and connect to a hub server
#
# Author: Fotios Lindiakos (fotios at redhat.com)
EPHEMERAL_DIR="/usr/local/bin"
SELENIUM_DIR="/usr/lib/selenium"
HUB_SERVER="http://ec2-107-20-156-96.compute-1.amazonaws.com:4444"
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"PublicSubnet": {
"Description": "Subnet ID for use by all public agent nodes",
"MaxLength": "18",
"ConstraintDescription": "must be a valid CIDR.",
"Default": "0.0.0.0/0",
"AllowedPattern": "^([0-9]+\\.){3}[0-9]+\\/[0-9]+$",
"MinLength": "9",
@thefotios
thefotios / Faraday.md
Last active December 30, 2015 09:49 — forked from hemanth/Faraday.md

HTTP client library is so convenient Faraday of Ruby

Faraday's so convenient Ruby HTTP client library

The development of the API wrapper [RestClient gem] or I [rest_client_gem]
What you need for OAuth was using [Net / HTTP] [net_http] + [OAuth gem] the [oauth_gem]

After reading the source of the API library [Twitter gem] and [twitter_gem] [Instagram gem] such as [instagram_gem]
Thing [Faraday gem] that [faraday_gem] had been commonly used

#!/usr/bin/env ruby
all_user_procs = %x[/bin/ps -e -o uid,pid | /bin/egrep "^\s+[0-9]{3,4}"]
pids_by_user = all_user_procs.lines.inject(Hash.new{|h,k| h[k] = []}) do |h,line|
(uid,pid) = line.split.map(&:to_i)
h[uid] << pid
h
end
#!/usr/bin/env ruby
all_user_procs = %x[/bin/ps -e -o uid,pid | /bin/egrep "^\s+[0-9]{3,4}"]
pids_by_user = all_user_procs.lines.inject(Hash.new{|h,k| h[k] = []}) do |h,line|
(uid,pid) = line.split.map(&:to_i)
h[uid] << pid
h
end
(str, err, rc = ::OpenShift::Runtime::Utils::oo_spawn('cgsnapshot 2> /dev/null')
keys = %w(cpu.cfs_period_us cpu.cfs_quota_us cpuacct.usage)
Hash[str.scan(/^group\sopenshift\/(.*?)\s(.*?)^}/m).map{|mg| [mg[0], Hash[mg[1].scan(/\s*(#{keys.join('|')})\s*=\s*"(.*)";/).map{|k,v| [k,v.to_i]}]] }]
@thefotios
thefotios / .node-version
Last active December 11, 2015 22:23
Advent
4.2.2