Skip to content

Instantly share code, notes, and snippets.

View arlm's full-sized avatar

Alexandre Rocha Lima e Marcondes arlm

View GitHub Profile
@arlm
arlm / elasticbeanstalk_deploy_iam_policy.md
Created October 21, 2015 19:22 — forked from RobertoSchneiders/elasticbeanstalk_deploy_iam_policy.md
IAM Policy for deploy on Elastic Beanstalk

I am deploying with this IAM using Codeship and Circle CI to Elastic Beanstalk. I had a lot of trouble with this config. I talked to the aws support for about 6 hours until this worked properly, so, I guess it is worth to share.

UPDATE: In the end, I have to use the AWSElasticBeanstalkFullAccess policy. My custom policy keep breaking every week with some new added permission or some EB internal change. Anyway, the IAM I was using is below.

This works for me with CircleCI and EB Cli.

{
    "Version": "2012-10-17",
    "Statement": [
        {
@arlm
arlm / submodule-pull.sh
Created October 28, 2015 19:16 — forked from stephenparish/submodule-pull.sh
Update submodules in a git repository to the latest, but exclude one..
git submodule foreach '[ "$path" == "submodule-to-exclude" ] || git pull origin master'
@arlm
arlm / gist:be4c1b9534831f381075
Created October 29, 2015 11:28 — forked from davidnunez/gist:1404789
list all installed packages in android adb shell
pm list packages -f
@arlm
arlm / Main.rb
Last active January 20, 2016 20:43
stockfighter.io
load "constants.rb"
load "functions.rb"
load "util.rb"
load "rest_api.rb"
load "websocket_api.rb"
load "gm_api.rb"
if ARGV.length > 0
case ARGV.first.chomp
when 'first_steps'
@arlm
arlm / lsmovedwindows.py
Last active February 2, 2016 17:02
Mac OS X scripts
#!/usr/bin/env python
# From http://blog.loudhush.ro/2014/04/what-process-owns-certain-window-mac-os.html
# Show all windows that were moved on the last 5 seconds
import time
from Quartz import CGWindowListCopyWindowInfo, kCGWindowListExcludeDesktopElements, kCGNullWindowID
from Foundation import NSSet, NSMutableSet
wl1 = CGWindowListCopyWindowInfo(kCGWindowListExcludeDesktopElements, kCGNullWindowID)
@arlm
arlm / test.cs
Created May 10, 2016 01:42
test
Console.WriteLine(test);
@arlm
arlm / operators-overriding.cs
Created May 12, 2016 12:40
GetHashCode, IEquatable and IComparable Support
// IEquatable<T>, IComparable, IComparable<T>
#region GetHashCode, IEquatable and IComparable Support
public override int GetHashCode()
{
return T?.Id ?? 0 ^ T.Value1 ^ T.Value2;
}
public static bool operator ==(T left, T right)
{
@arlm
arlm / StringSize.cs
Last active May 22, 2016 06:34
Get StringSize since iOS7
var dictionary = new NSDictionary(UIStringAttributeKey.Font, Font.Name);
var attributes = new UIStringAttributes(dictionary);
var size = text.GetSizeUsingAttributes(attributes);
@arlm
arlm / iosStringSize.cs
Created May 21, 2016 12:18 — forked from ozzieperez/iosStringSize.cs
Xamarin IOS - Get the size of a string
//Method 1: No restrictions
((NSString)t.Text).GetSizeUsingAttributes(new UIStringAttributes {Font = t.Font});
//Method 2: Has to fit within a width
label.Frame = new CGRect(CGPoint.Empty, ((NSString)label.Text).GetBoundingRect(
new CGSize(width, nfloat.MaxValue),
NSStringDrawingOptions.UsesLineFragmentOrigin,
new UIStringAttributes { Font = label.Font},
null
).Size);