Skip to content

Instantly share code, notes, and snippets.

View alfaproject's full-sized avatar

João Dias alfaproject

View GitHub Profile
@alfaproject
alfaproject / bamboo.userscript.js
Created April 15, 2015 15:41
Bamboo UserScript to automate builds
// ==UserScript==
// @name Bamboo Builder
// @namespace cherrytech
// @version 0.1
// @author Joao Dias <joao.dias@cherrygroup.com>
// @match http://bamboo.cherrytech.com/browse/*
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
@alfaproject
alfaproject / .bash_profile_vpn
Last active August 29, 2015 14:14
OSX CherryTech SSH BMIT alias
# Check if the VPN is connected
# @param $1 vpn name
function _vpn_connected
{
scutil --nc status "$1" | head -n 1 | grep -q Connected
}
# Wait up to 20 seconds for VPN connection
# @param $1 vpn name
function _vpn_poll_until_connected
@alfaproject
alfaproject / countries.php
Created January 16, 2015 12:57
PHP countries array
'countries' => array(
'us' => array(
'dialCode' => 1,
'name' => 'United States',
'enabled' => false,
),
'gb' => array(
'dialCode' => 44,
'name' => 'United Kingdom',
'enabled' => false,
@alfaproject
alfaproject / DebugSoapServer.php
Created November 12, 2014 14:07
SoapServer sub class for debugging requests and responses
<?php
class DebugSoapServer extends SoapServer
{
public function handle($request = null)
{
// check input param
if ($request === null) {
$request = file_get_contents('php://input');
}
@alfaproject
alfaproject / rapidssl_ca_bundle.pem
Created June 17, 2014 07:22
RapidSSL CA Bundle
-----BEGIN CERTIFICATE-----
MIID1TCCAr2gAwIBAgIDAjbRMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
YWwgQ0EwHhcNMTAwMjE5MjI0NTA1WhcNMjAwMjE4MjI0NTA1WjA8MQswCQYDVQQG
EwJVUzEXMBUGA1UEChMOR2VvVHJ1c3QsIEluYy4xFDASBgNVBAMTC1JhcGlkU1NM
IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx3H4Vsce2cy1rfa0
l6P7oeYLUF9QqjraD/w9KSRDxhApwfxVQHLuverfn7ZB9EhLyG7+T1cSi1v6kt1e
6K3z8Buxe037z/3R5fjj3Of1c3/fAUnPjFbBvTfjW761T4uL8NpPx+PdVUdp3/Jb
ewdPPeWsIcHIHXro5/YPoar1b96oZU8QiZwD84l6pV4BcjPtqelaHnnzh8jfyMX8
N8iamte4dsywPuf95lTq319SQXhZV63xEtZ/vNWfcNMFbPqjfWdY3SZiHTGSDHl5
@alfaproject
alfaproject / Enumerations.php
Created October 18, 2012 09:37
RuneScape related PHP classes to aid development
<?php
// Skills
define('OVER', 'Overall');
define('ATTA', 'Attack');
define('DEFE', 'Defence');
define('STRE', 'Strength');
define('HITP', 'Constitution');
define('RANG', 'Ranged');
define('PRAY', 'Prayer');
define('MAGI', 'Magic');
@alfaproject
alfaproject / jfifremove.c
Created October 18, 2012 09:28
PHP script to optimize images file size recursively in a given in a folder
/*
* Strip JFIF headers from the JPEG image on stdin, and write
* the result to stdout. Won't work unmodified on Windows
* because of the text/binary problem. Not thoroughly tested.
*/
#include <stdio.h>
#include <stdlib.h>
void fail(const char* msg) {
@alfaproject
alfaproject / sapo_f25.php
Created July 1, 2012 16:18
Sapo F25 Challenge
<?php
/**
* quick f15 prototype that should do what's needed
* no item indexes to make it harder
* `$items[$i] = 'item '. $i` would be too easy and even smaller
*/
function f15($page)
{
$first = ($page - 1) * 15 + 1;
for ($i = $first; $i < $first + 15; $i++)