Skip to content

Instantly share code, notes, and snippets.

View giorgiosironi's full-sized avatar

Giorgio Sironi giorgiosironi

View GitHub Profile
default:
autoload:
'': %paths.base%/features/bootstrap
suites:
default:
paths:
features: %paths.base%/features
context:
class: FeatureContext
#does not work:
@giorgiosironi
giorgiosironi / gist:f7dbd320ae4d6194cc51
Created November 27, 2015 19:39
Hack type checking example
[20:38:45][giorgio@Elliot:~/code/hack]$ cat test.php
<?hh
/*
function f(): int {
return 'not an int';
}
*/
class MyClass {
}
$object = new MyClass();
@giorgiosironi
giorgiosironi / -
Created May 24, 2016 14:58 — forked from anonymous/-
done.
{'tag:Name': ['elife-lax-develop--test']}
1464101753.950491 - ERROR - MainProcess - buildercore.core - caught an exception attempting to discover more information about this instance. The instance may not exist yet ...
Traceback (most recent call last):
File "/Users/giorgiosironi/elife-builder/src/buildercore/core.py", line 124, in stack_data
inst = find_ec2_instance(stackname)[0]
IndexError: list index out of range
Traceback (most recent call last):
File "/Users/giorgiosironi/elife-builder/venv/lib/python2.7/site-packages/fabric/main.py", line 745, in main
@giorgiosironi
giorgiosironi / drupal_rest_server_exception_logging.patch
Last active July 26, 2016 09:44
Making Drupal 7 rest_server log exceptions
--- a/servers/rest_server/includes/RESTServer.inc 2016-07-26 09:52:28.709829797 +0100
+++ b/servers/rest_server/includes/RESTServer.inc 2016-07-26 09:52:04.253829191 +0100
@@ -645,6 +645,16 @@
$error_code = $exception->getCode();
$error_message = $exception->getMessage();
$error_data = method_exists($exception, 'getData') ? $exception->getData() : '';
+ error_log(var_export([
+ 'exception' => [
+ 'message' => $error_message,
+ 'code' => $error_code,
@giorgiosironi
giorgiosironi / gist:e10b8dc47efa79fb3886be6acf7bdb60
Created September 22, 2016 16:18
The AWS SNS + SQS pair is the first time I see a pub/sub where you send XML and it comes out as JSON
Originally sending "<key>value</key>"
Message received!
{
"Type" : "Notification",
"MessageId" : "9d30ae1f-9180-5049-870a-fe41946fbfd9",
"TopicArn" : "arn:aws:sns:us-east-1:14343913592:bus-articles--end2end",
"Message" : "<key>value</key>",
"Timestamp" : "2016-09-22T16:15:43.378Z",
"SignatureVersion" : "1",
"Signature" : "...",
@giorgiosironi
giorgiosironi / gist:b98f01c8ff3bbec1edd27750813290b8
Created October 8, 2016 11:08
Installing mit-scheme on my Ubuntu 14.04 removes hhvm
...
The following extra packages will be installed:
libmcrypt4:i386 libpq5:i386
Suggested packages:
libmcrypt-dev:i386 mcrypt:i386 mit-scheme-dbg:i386 mit-scheme-doc:i386
The following packages will be REMOVED
hhvm libmcrypt4 libpq-dev libpq5
The following NEW packages will be installed
libmcrypt4:i386 libpq5:i386 mit-scheme:i386

Export current plot from ggplot

https://stackoverflow.com/a/11304431/91590

As per @naught101's suggestion - for a 5x7 (inch!) pdf file which is a convenient size to be pasted into an A4 Word document, the following works well:

dev.copy2pdf(file="example.pdf", width = 7, height = 5)
@giorgiosironi
giorgiosironi / gist:ef4f326d0e959cbd826d9a6cef769b44
Created September 22, 2017 16:09
Sample output from build triggered by shared library update
Started by GitHub push by giorgiosironi
Checking out git git@github.com:elifesciences/profiles.git into /var/lib/jenkins/workspace/test-profiles@script to read Jenkinsfile
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@github.com:elifesciences/profiles.git # timeout=10
Fetching upstream changes from git@github.com:elifesciences/profiles.git
> git --version # timeout=10
using GIT_SSH to set credentials SSH private key of the jenkins user
> git fetch --tags --progress git@github.com:elifesciences/profiles.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/develop^{commit} # timeout=10
@giorgiosironi
giorgiosironi / init.sls
Created September 26, 2017 07:34
Attempt to reproduce require_in misordering
second:
cmd.run:
- name: echo "second"
first:
cmd.run:
- name: echo "first"
- require_in:
- cmd: second
$ ls /usr/bin/*-* | wc -l
801
$ ls /usr/bin/*_* | wc -l
243