Skip to content

Instantly share code, notes, and snippets.

View dirtyhenry's full-sized avatar

Mick F dirtyhenry

View GitHub Profile
@dirtyhenry
dirtyhenry / Gemfile
Created June 26, 2017 10:23
iOS Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
gem 'cocoapods'
gem 'fastlane'
gem 'jazzy'
@dirtyhenry
dirtyhenry / appannie_histogram.R
Created September 14, 2016 17:39
R Script to get a plot of weekly/monthly downloads aggregations from App Annie files.
#
# appannie_histogram.R
#
# Create weekly and monthly aggregations bar plots of your downloads
# from AppAnnie CSV files.
#
# Improvements:
#
# * First and last week of years can have much less than 7 days and create false
# decreases of downloads.
@dirtyhenry
dirtyhenry / SmackAPITest.java
Created January 14, 2014 14:58
Fooling around the Smack API (a unit test + a POM to get the dependencies)
package com.bootstragram.xmpp;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
@dirtyhenry
dirtyhenry / SELECT.sql
Last active January 2, 2016 09:08
Spam identification for SPIP 3
SELECT auteur, email_auteur, LEFT(texte, 50)
FROM spip_forum
WHERE LEFT(texte, 20) LIKE '%http%'
AND statut <> 'spam'
ORDER BY maj DESC;
@dirtyhenry
dirtyhenry / gist:7547064
Created November 19, 2013 15:27
iOS code that: 1/ validates an email found in a UITextField 2/ check chances of spelling mistakes
- (NSArray *)allMyContacts {
// cf. http://stackoverflow.com/questions/12083643/how-do-i-correctly-use-abaddressbookcreatewithoptions-method-in-ios-6
CFErrorRef error = nil;
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, &error);
__block BOOL accessGranted = NO;
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
accessGranted = granted;
@dirtyhenry
dirtyhenry / bootstragram-dark.terminal
Created October 28, 2013 13:54
My Terminal configurations
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGHyBYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKUHCBEVHFUkbnVsbNQJCgsMDQ4PEFdOU1doaXRlXE5TQ29sb3JTcGFjZV8QEk5T
Q3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NCMAAQA4ACgATSEgwTFFROU0lEEAKAA9IWFxgZ
WiRjbGFzc25hbWVYJGNsYXNzZXNcTlNDb2xvclNwYWNlohobXE5TQ29sb3JTcGFjZVhO
@dirtyhenry
dirtyhenry / S3permission
Last active December 23, 2015 18:29
This is the permission you need to set with Amazon AWS S3 to provide full access to a "mybucket" bucket and read-access only to all your buckets.
{
"Statement": [
{
"Effect": "Allow",
"Action": "S3:*",
"Resource": "arn:aws:s3:::mybucket/*",
"Condition": {}
},
{
"Effect": "Allow",
@dirtyhenry
dirtyhenry / agile-jira-workflow.xml
Created July 23, 2013 14:28
Agile JIRA Workflow Definition
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.8//EN" "http://www.opensymphony.com/osworkflow/workflow_2_8.dtd">
<workflow>
<meta name="jira.update.author.key">mick</meta>
<meta name="jira.description">Agile JIRA Workflow Definition</meta>
<meta name="jira.updated.date">1374589472735</meta>
<initial-actions>
<action id="1" name="Create">
<validators>
<validator name="" type="class">
@dirtyhenry
dirtyhenry / Gabriel.java
Created June 18, 2013 09:57
Weird code with Java loop optimization at runtime
package com.com.com;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
public class Gabriel {
private final static Logger LOG = Logger.getLogger(Gabriel.class);
@dirtyhenry
dirtyhenry / simplest-s3-upload.rb
Created June 4, 2013 11:55
This is the Ruby code I use to test/validate S3 access policies.
require 'fog'
connection = Fog::Storage.new({
:provider => 'AWS',
:aws_access_key_id => 'access_key_id',
:aws_secret_access_key => 'secret_acces_key'
})
directory = connection.directories.get('bucket_name')