Skip to content

Instantly share code, notes, and snippets.

View acroca's full-sized avatar
👾

Albert Callarisa acroca

👾
View GitHub Profile
@acroca
acroca / keybase.md
Created August 29, 2018 08:32
keybase.md

Keybase proof

I hereby claim:

  • I am acroca on github.
  • I am acroca (https://keybase.io/acroca) on keybase.
  • I have a public key ASB6dJV-oFIeVxD-nHsC0I47K6k8G4etETRcAHVMxh2cEwo

To claim this, I am signing this object:

@acroca
acroca / test.go
Last active September 24, 2015 16:10
package main
import "fmt"
type Something interface {
DoA()
DoB()
}
type Person struct {
@acroca
acroca / gist:dac7cdc196b26c6ae65d
Created April 28, 2015 09:16
kubernetes error log
➜ workspace docker run --net=host -d -v /var/run/docker.sock:/var/run/docker.sock gcr.io/google_containers/hyperkube:v0.14.2 /hyperkube kubelet --api_servers=http://localhost:8080 --v=2 --address=0.0.0.0 --enable_server --hostname_override=127.0.0.1 --config=/etc/kubernetes/manifests
ee0b490f74f6bc9b70c1336115487b38d124bdcebf09b248cec91832e0e9af1d
➜ workspace docker logs -f ee0b490f74f6bc9b70c1336115487b38d124bdcebf09b248cec91832e0e9af1d
W0428 09:09:41.479862 1 server.go:249] Could not load kubernetes auth path: stat : no such file or directory. Continuing with defaults.
I0428 09:09:41.479989 1 server.go:168] Using root directory: /var/lib/kubelet
I0428 09:09:41.480061 1 manager.go:103] cAdvisor running in container: "/docker/ee0b490f74f6bc9b70c1336115487b38d124bdcebf09b248cec91832e0e9af1d"
I0428 09:09:41.480266 1 fs.go:87] Filesystem partitions: map[/dev/sda1:{mountpoint:/etc/resolv.conf major:8 minor:1}]
I0428 09:09:41.481758 1 machine.go:223] Couldn't collect info from a
@acroca
acroca / gist:9181484
Created February 24, 2014 03:27
Who commits lines longer than 120 characters?
grep '.\{120,\}' -Hn `git ls-files` | awk '{split($0, a, ":"); print "git blame -eL "a[2]","a[2]" "a[1]}' | bash | awk '{split($0, a, "<"); split(a[2], b, ">"); print b[1]}' | sort | uniq -c
@acroca
acroca / coffeescript-ps.sublime-snippet
Last active December 31, 2015 17:09
Sublimetext `ps` snippet for multiple languages Copy them to ~/Library/Application Support/Sublime Text 3/Packages/User
<snippet>
<content><![CDATA[
console.log('''===> $1: ''', $1)
]]></content>
<tabTrigger>ps</tabTrigger>
<scope>source.coffee</scope>
<description>Prints out a variable</description>
</snippet>
'use strict';
var express = require('express');
var connect = require('connect');
var http = require('http');
var newrelic = require('newrelic');
function allowCrossDomain(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
next();
@acroca
acroca / gist:6227680
Last active December 21, 2015 01:29
Hack for Angular.js to inject authentication headers based on url and request body (if needed).
// It works for v1.1.5.
// It's very fragile, so be careful using it with other versions.
//
// To understand how it works, check this out: https://github.com/angular/angular.js/blob/master/src/ng/httpBackend.js#L26-L31
//
// Tried and failed more elegant solutions:
// - Interceptors. Couldn't get the request body.
// - `transformRequest` for the resource or $http. Couldn't get the body or the URL.
app.config(function ($httpBackendProvider) {
@acroca
acroca / gist:3776675
Created September 24, 2012 15:53
Copy Dropbox public URL bash script
# This script copies the public from the last updated file in your Dropbox public folder.
# I use it to add screenshots in pull request description.
#
# Set DROPBOX_USER_ID with the user_id you get when generating public urls
# Replace the path ~/Dropbox/Public with your Dropbox public folder.
dropbox_public_url() {
last_db_item="`find ~/Dropbox/Public -type f -exec stat -f '%m %N' {} \; | sort -n | tail -1 | cut -f2- -d' ' | awk '{ gsub(/.*Public/, \"\"); print }'`"
echo "https://dl.dropbox.com/u/$DROPBOX_USER_ID$last_db_item" | pbcopy
}
@acroca
acroca / gist:3413187
Created August 21, 2012 07:39
Bash script to get your started stories
#!/bin/bash
# Install xmlstarlet: brew install xmlstarlet
# Set your PIVOTAL_TOKEN and PIVOTAL_NAME
for i in `curl -s -H "X-TrackerToken: $PIVOTAL_TOKEN" -X GET http://www.pivotaltracker.com/services/v3/projects | xml sel -t -v "//projects/project/id"`
do
(curl -s -H "X-TrackerToken: $PIVOTAL_TOKEN" -X GET http://www.pivotaltracker.com/services/v3/projects/$i/stories?filter=owner%3A$PIVOTAL_NAME%20state%3Astarted |
xml sel -t -m "//stories/story" -v id -o " - " -v name -n) &
done