Skip to content

Instantly share code, notes, and snippets.

View keif's full-sized avatar

Keith Baker keif

View GitHub Profile
<?php
// First we require the xml2json file of course.
require_once($modx->getOption('core_path').'components/simplx/common/xml2json.php');
// xml2json simply takes a String containing XML contents as input.
// Remember that the preprocessor always get a parameter called $dataSet
// containing the complete dataSet recieved from the dataSourceUrl or the
// dataSet Snippet parameter.
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active December 19, 2024 09:32
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@ndarville
ndarville / business-models.md
Last active October 23, 2024 17:18
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@kmorcinek
kmorcinek / gitconfig
Last active February 27, 2022 18:45
Add it to ".gitconfig" file in your user directory. Configuration & aliases for git.
[core]
# autocrlf = true/input # it should be done explicit using .gitattributes https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings
[pull]
rebase = true
[push]
default = current
[alias]
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%an]" --decorate
lst = log --pretty=format:%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%an] --decorate -10
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cgreen\\ [%an]" --decorate --date=short
@weisjohn
weisjohn / gmail-test.sh
Created September 10, 2014 22:04
test your contacts against the gmail password compilation
#!bin/bash
echo "Export your Gmail contacts as a CSV, name it contacts.csv, put it in this directory, press Enter"
read foo
wget --referer=https://forum.btcsec.com https://forum.btcsec.com/uploads/manual_09_2014/google_5000000.7z
echo "I haven't worked out a way to unzip .7z files from a cli yet... patches welcome"
echo "Press enter when you've unzipped the file"
read foo
@amatiasq
amatiasq / curry.js
Last active March 15, 2019 10:34
Simple way to recursively curry javascript functions http://jsfiddle.net/amatiasq/osrsomq0/
/**
* @param {Function} fn Function to curry.
* @param {Number} lenght The arguments required to invoke the function. Optional. By default is fn.length
* @returns {Function} The currified function.
*/
function curry(fn, length) {
length = length || fn.length;
return function currified() {
var args = [].slice.call(arguments);
(ns calc.core
(:require
[instaparse.core :as insta]
[clojure.pprint :refer [pprint]]))
; Define a parser:
(def parser
(insta/parser
"
<expr> = sum-expr
@metacurb
metacurb / delete-instances.ps1
Last active August 19, 2019 15:42
Delete all AWS EC2 instances in all regions via Windows Powershell
$regions = aws ec2 describe-regions --query Regions[*].[RegionName] --output text
foreach ($region in $regions) {
Write-Output "Terminating Instances in region: '$region'..."
aws configure set region $region
$ids = aws ec2 describe-instances --query "Reservations[*].Instances[*].{ID:InstanceId}" --output text --region $region
$idArray = $ids.Split([Environment]::NewLine)
foreach($id in $idArray) {
aws ec2 modify-instance-attribute --no-disable-api-termination --instance-id $id --region $region