Skip to content

Instantly share code, notes, and snippets.

Fotios Lindiakos thefotios

Block or report user

Report or block thefotios

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dcos.json
{
"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 / day1.sh
Last active Dec 2, 2015
Advent of Code 2015
View day1.sh
# Part 1
awk 'BEGIN{ FS = ""} {for(i = 1; i <= NF; i++) if($i ~ /\(/){ floors++}else{floors--} } END { print floors}'
# Part 2
awk 'BEGIN{ FS = ""} {for(i = 1; i <= NF; i++){ if($i ~ /\(/){ floors++}else{floors--}; if(floors < 0){print i; break}}} END { print floors}'
@thefotios
thefotios / emojify.sh
Created Jul 21, 2015
Makes properly sized emoji for slack. Just point this at any URL. You'll need to have `convert` (part of ImageMagick)
View emojify.sh
#!/usr/bin/env bash
url=$1;
output=${2-output.png};
size=${3-128};
curl --silent -kL $url | convert - -resize ${size}x${size} $output;
View keybase.md

Keybase proof

I hereby claim:

  • I am thefotios on github.
  • I am thefotios (https://keybase.io/thefotios) on keybase.
  • I have a public key whose fingerprint is 2264 2751 B5AD E6D2 DC85 FA4A 91BD C79C 39F3 48FD

To claim this, I am signing this object:

View 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

View test.rb
#!/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
You can’t perform that action at this time.