Skip to content

Instantly share code, notes, and snippets.

View mbadolato's full-sized avatar
🤘

Mark Badolato mbadolato

🤘
  • Cybernox Technologies
  • Phoenix
View GitHub Profile
@mbadolato
mbadolato / ILI_zork.txt
Created September 12, 2017 19:44
Instructions on how to reboot the network at our old company's old building, done Zork style. Courtesy of David "Kitchen" Sinck
Welcome to Ilork!
ilork> look
You are in the office. The internet is down. To the East, there is a glass door to the hallway.
ilork> east
You are in a hallway leading North and South, facing elevator doors
@mbadolato
mbadolato / bgrep
Created April 23, 2015 19:48
bgrep -- a wrapper around a grep program that decompresses files as needed
#!/bin/sh
# bgrep -- a wrapper around a grep program that decompresses files as needed
PATH="/usr/bin:$PATH"; export PATH
prog=`echo $0 | sed 's|.*/||'`
case "$prog" in
*egrep) grep=${EGREP-egrep} ;;
*fgrep) grep=${FGREP-fgrep} ;;
*) grep=${GREP-grep} ;;
@mbadolato
mbadolato / bash_history_to_zsh.js
Created April 23, 2015 19:45
Bash History to Zsh History Converter
// This is how I used it:
// $ node bash-history-to-zsh-history.js >> ~/.zsh_history
var fs = require("fs");
var a = fs.readFileSync("bash_history");
var time = Date.now();
a.toString().split("\n").forEach(
function(line) {
console.log(": "+ (time++) + ":0;" + line);
@mbadolato
mbadolato / WilsonConfidenceIntervalCalculator.php
Last active May 4, 2023 04:14
PHP translation of the Wilson ConfidenceInterval Calculator. Ported from Ruby and uses a hardcoded (pre-calculated) confidence (z value) instead of a dynamic calculation with a translation of Ruby's Statistics2.pnormaldist method. Since z doesn't change once it's computed, nor is the computation dependant on the passed-in values, calculating it …
<?php
/*
* (c) Mark Badolato <[email protected]>
*
* This content is released under the {@link http://www.opensource.org/licenses/MIT MIT License.}
*/
namespace Bado;
@mbadolato
mbadolato / Mac version
Last active December 19, 2015 00:39 — forked from lyrixx/post-checkout
#!/bin/bash
# Put this file at: .git/hooks/post-checkout and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
NOCOLOR='\x1B[0m'
REDCOLOR='\x1B[37;41m'
@mbadolato
mbadolato / 1-Explanations.md
Last active December 17, 2015 11:49 — forked from danvbe/1-Explanations.md
Integrating HWIOAuthBundle and FOSUserBundle

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
server {
listen 80;
server_name localhost;
root /home/website/web;
rewrite ^/app\.php/?(.*)$ /$1 permanent;
try_files $uri @rewriteapp;
location @rewriteapp {
@mbadolato
mbadolato / unicorn.rb
Created February 23, 2013 23:05 — forked from defunkt/gist:206253
Example unicorn.rb file for Github's configuration
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@mbadolato
mbadolato / build.xml
Created January 20, 2012 18:34
Jenkins build.xml file for Symfony 2 projects
<?xml version="1.0" encoding="UTF-8"?>
<project name="YOUR_PROJECT_NAME" default="build" basedir=".">
<property name="source" value="src"/>
<property name="ignore" value="build"/>
<target name="clean"
description="Clean up and create artifact directories">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>