Skip to content

Instantly share code, notes, and snippets.

@mithereal
mithereal / chicago-boss-version-pre-commit
Last active August 29, 2015 13:59
chicago boss version commit hook
#!/bin/bash
### get version
VER=$(cat src/*.app.src | grep -Po 'appver."[0-9]*\.[0-9]*\.[0-9]"' | grep -Po '[0-9]*\.[0-9]*\.[0-9]')
VER_ARRAY=(`echo $VER | tr "." "\n"`)
echo "Type of Release: Maj(j), Min(m), Patch(p) (blank skips release tag)"
read type
if ["$type" == "j"]
then
@mithereal
mithereal / install-opencart-plugin.sh
Last active August 29, 2015 14:01
command line opencart module installer
#!/bin/bash
DESTINATION_HELP='-p project_destination_path'
PROJECT_HELP='-r Resets the Project dir'
CWD=$(pwd)
function help()
{
echo ""
echo "Opencart Plugin Installer by Jason Clark <mithereal@gmail.com>"
@mithereal
mithereal / pre-commit
Created June 5, 2014 01:12
chicago boss pre-commit hook
#!/bin/sh
#
#This is a pre commit hook for Chicage Boss
erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell | sed "s/\"*//g" > .preferred_otp_version
@mithereal
mithereal / gist:542e24104ebd6cb040d9
Last active August 29, 2015 14:20
aws ubuntu vagarant box with erlang and php5
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrant on AWS
# Jason Clark
# This sample sets up 1 VM ('delta') with erlang, and apache installed.
# Adjustable settings
CFG_TZ = "US/Pacific" # timezone, like US/Pacific, US/Eastern, UTC, Europe/Warsaw, etc.
@mithereal
mithereal / timeout_detect.php
Last active August 29, 2015 14:23
detect php max timeout limit on shared hosting
<?php
$max_timeout = 600;
$start = time();
register_shutdown_function('shutdown',$start);
for(;;)
{
$finish = time();
<?php
function arrayToSql($array=array(),$pre='',$post='',$xor='&&')
{
$end = end(array_keys($array));
$sql = $pre;
foreach($array as $k =>$v){
$sql .= "`$k` = '$v' ";
if($k != $end){
$sql .= "$xor ";
@mithereal
mithereal / mysqli2boss.php
Last active August 29, 2015 14:24
This will convert your mysqli schema to chicago boss base app, create models, controllers, and views based on the schema
#!/usr/bin/php -q
<?php
### This will convert your mysql schema to chicago boss base app, create models, controllers, and views based on the schema
### place under the app root ex /appname/mysqlitoboss.php
### run from cli ex./mysqlitoboss.php or php -f mysqlitoboss.php
/* Define STDIN in case if it is not already defined by PHP for some reason */
@mithereal
mithereal / backup-github.sh
Last active August 29, 2015 14:26 — forked from bjtitus/backup-github.sh
A shell script to backup your Github organization's repos.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization whose repos will be backed up
GHBU_API=${GHBU_API-"https://api.github.com"} # base URI for the GitHub API
GHBU_GITHOST=${GHBU_GITHOST-"<CHANGE-ME>.github.com"} # the GitHub hostname (see comments)
# I recommend using an API token so it is easily trackable and removable.
# Note that you MUST have SSH keys for a user with the access to all repos set up
#!/bin/bash
while sleep 55
do
players_list=$(gdbus call --session --dest org.freedesktop.DBus \
--object-path / --method org.freedesktop.DBus.ListNames | \
awk 'BEGIN { RS=","; } /org.mpris.MediaPlayer2./ { gsub(/[\[\]()\x27]/, ""); print $1; }')
for player in $players_list
do
state=$(gdbus call --session \
@mithereal
mithereal / index.html
Created December 13, 2015 20:47
Search Github Cards via React.js
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js" data-semver="2.1.4" data-require="jquery@*"></script>
<script data-require="moment.js@*" data-semver="2.10.2" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>