Skip to content

Instantly share code, notes, and snippets.

View mbijon's full-sized avatar
🎯
Focusing

Mike Bijon mbijon

🎯
Focusing
View GitHub Profile
@mbijon
mbijon / benchmark_wordpress_seo-auto-linker.php
Created September 18, 2012 08:57
Quick benchmarker for WordPress Plugin: SEO Auto Linker. For @danielbachhuber b/c it uses many preg_matches
<?php
/*
* Usage:
* 1. Paste into Debug Bar console and Run
* 2. Run it several times (just in case iTunes is running on your dev server)
*
* Benchmarking Alternatives:
* - Wrap the real SEO Auto Linker for wp-cli and replace the call to content()
* - Add this quick & dirty benchmark loop to Debug Bar
*
@mbijon
mbijon / svn_deploy.php
Created December 22, 2011 23:09
Checkout & deploy from SVN to local path, in PHP (GPLv2)
$svn_address = "https://domain/";
$svn_user = "foo";
$svn_user = "foopass";
$web_path = "/var/www/foo.com/public_html/";
$temp_path = "/data/tmp/";
$backup_path = $path . "/data/backup/";
// Checkout SVN
$svn_command = "svn export " . $svn_address . " " . $temp_path "/ --username=" . $svn_user . " --password=";
echo $svn_command . "<br />";
@mbijon
mbijon / currency-to-float.php
Created March 17, 2012 01:19
Human-format currency $'s converted to machine floating points
<?php
/*
* Human-format currency $'s converted to machine floating points
*/
// Dollar amount via GET (not very secure)
$raw_dollar_amount = ( isset($_GET['dollar_amount']) ) ? htmlentities( $_GET['dollar_amount'], ENT_QUOTES, 'UTF-8' ) : FALSE;
if ( $raw_dollar_amount ) {
// Create a return value in case nothing done
$float_dollar_amount = $raw_dollar_amount;
@mbijon
mbijon / iframe.html
Created August 4, 2013 19:42
Tor fingerprinting code-injection (allegedly by FBI) --from: http://www.twitlonger.com/show/n_1rlo0uu
//nl7qbezu7pqsuone.onion/?requestID=203f1a01-6bc7-4c8b-b0be-2726a7a3cbd0 iframe:
<html>
<body>
<iframe frameborder=0 border=0 height=1 width=1 id="iframe"> </iframe>
</body>
</html>
<script>
@mbijon
mbijon / umap_sparse.py
Created August 22, 2018 16:24 — forked from johnhw/umap_sparse.py
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@mbijon
mbijon / wp_custom_featured_image.php
Last active March 22, 2018 10:11
Customize the WordPress Featured Image metabox: Because can't call add/remove_meta_box inline. Actions must be 'admin-head' or later

Keybase proof

I hereby claim:

  • I am mbijon on github.
  • I am mbijon (https://keybase.io/mbijon) on keybase.
  • I have a public key ASDneF_5-coE6CEyRCzP3YMftB04es5vID21FVADl4k39go

To claim this, I am signing this object:

@mbijon
mbijon / gist:2ddf2bfecd58e4921c1350f495261a80
Created June 20, 2017 19:04
Ruby AES Encryption using OpenSSL
#!/usr/bin/env ruby
require "openssl"
require 'digest/sha2'
require 'base64'
# We use the AES 256 bit cipher-block chaining symetric encryption
alg = "AES-256-CBC"
# We want a 256 bit key symetric key based on some passphrase
digest = Digest::SHA256.new
@mbijon
mbijon / gist:5116961cdb728bcaa006a9932d42cb2d
Created June 20, 2017 19:04
Ruby AES Encryption using OpenSSL
#!/usr/bin/env ruby
require "openssl"
require 'digest/sha2'
require 'base64'
# We use the AES 256 bit cipher-block chaining symetric encryption
alg = "AES-256-CBC"
# We want a 256 bit key symetric key based on some passphrase
digest = Digest::SHA256.new
@mbijon
mbijon / xcode8.js
Created April 17, 2017 23:21 — forked from dpogue/xcode8.js
Hook for Cordova iOS to support "developmentTeam" in buildConfig.json
"use strict";
var fs = require('fs');
var path = require('path');
module.exports = function(context) {
var encoding = 'utf-8';
var filepath = 'platforms/ios/cordova/build.xcconfig';
if (context.opts.cordova.platforms.indexOf('ios') === -1) return;