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 / juggernaut_channels.rb
Created December 22, 2016 23:49 — forked from maccman/juggernaut_channels.rb
Sinatra Server Side Event streaming with private channels.
# Usage: redis-cli publish message.achannel hello
require 'sinatra'
require 'redis'
conns = Hash.new {|h, k| h[k] = [] }
Thread.abort_on_exception = true
get '/' do
@mbijon
mbijon / canvasrecord.js
Created November 6, 2016 21:36 — forked from PaulKinlan/canvasrecord.js
Screen recorder in JS
(function() {
let canvas = document.querySelector('canvas');
// Optional frames per second argument.
let stream = canvas.captureStream(25);
let recorder = new MediaRecorder(stream, options);
let blobs = [];
function download(blob) {
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
@mbijon
mbijon / move_to_rds.rb
Created October 10, 2016 01:35 — forked from guenter/move_to_rds.rb
A quick and dirty script to move a database into Amazon RDS (or any other database). Can transfer part of the data beforehand.
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
#!/usr/bin/env ruby
require 'rubygems'
require 'friendly'
Friendly.configure(
:adapter => 'mysql',
:host => 'localhost',
:user => 'root',
:password => '',
#!/usr/bin/env ruby
require 'rubygems'
require 'friendly'
Friendly.configure(
:adapter => 'mysql',
:host => 'localhost',
:user => 'root',
:password => '',
@mbijon
mbijon / after_prepare.es5.js
Created September 7, 2016 17:36 — forked from smowden/after_prepare.es5.js
ES5 version for adding intent filters via cordova hooks on android
'use strict';
module.exports = function (context) {
var fs = require('fs');
var _ = require('lodash');
var scheme = 'flowkey';
var insertIntent = '\n <intent-filter>\n <action android:name="android.intent.action.VIEW"></action>\n <category android:name="android.intent.category.DEFAULT"></category>\n <category android:name="android.intent.category.BROWSABLE"></category>\n <data android:scheme="' + scheme + '"></data>\n </intent-filter>\n ';
var manifestPath = context.opts.projectRoot + '/platforms/android/AndroidManifest.xml';
var androidManifest = fs.readFileSync(manifestPath).toString();
@mbijon
mbijon / lock-plugins.php
Created August 26, 2016 02:17 — forked from daggerhart/lock-plugins.php
Simple plugin that prevents requests for updats for a given list of plugins.
<?php
/*
* Plugin Name: Lock plugin updates
* Description: Prevent plugin updates
* Version: 1.0.0
* Author: daggerhart
*/
add_filter( 'http_request_args', 'lock_plugins_http_request_args', 5, 2 );
@mbijon
mbijon / rebuld_nginx_with_pagespeed.sh
Created June 27, 2016 14:46 — forked from gottaloveit/rebuld_nginx_with_pagespeed.sh
This is a script for Debian/ Ubuntu that will rebuild the latest Nginx deb package from nginx.org with Google Pagespeed. There are a couple other modules the script will prompt you to ask if you want to remove them. They are http-dav, http-flv, http-mp4, mail, mail_ssl. Will prompt to add http-geoip and ask if you want to change the nginx user t…
#!/bin/bash
echo "This script will rebuild a Debian style package (deb) of latest stable"
echo "Nginx. The original deb is from nginx.org apt repository."
echo
echo "This will prompt you yes or no on a few changes to the build as well as"
echo "it will compile and package the latest Google NGX Pagespeed module."
echo
echo "This is built and tested on Ubuntu 14.04 LTS, fresh OS install."
echo "There are no guarantees, and I take no liability if it breaks, but it"
@mbijon
mbijon / pg-pong.py
Created June 1, 2016 14:35 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
177 read,my_real_read,my_net_read,do_command,do_handle_one_connection,handle_one_connection,start_thread,clone
8 pthread_cond_wait@@GLIBC_2.3.2,inline_mysql_cond_wait,optimized,optimized,do_handle_one_connection,handle_one_connection,start_thread,clone
4 __lll_lock_wait_private,_L_lock_9495,malloc,mem_heap_create_block,mem_heap_create_func,row_sel_store_mysql_rec,row_search_for_mysql,ha_innobase::general_fetch,join_read_next_same,sub_select,do_select,JOIN::exec,mysql_select,handle_select,execute_sqlcom_select,mysql_execute_command,mysql_parse,dispatch_command,do_handle_one_connection,handle_one_connection,start_thread,clone
3 __lll_lock_wait_private,_L_lock_5189,_int_free,mem_heap_block_free,mem_heap_free_func,row_sel_store_mysql_rec,row_search_for_mysql,ha_innobase::general_fetch,handler::read_multi_range_next,QUICK_RANGE_SELECT::get_next,rr_quick,sub_select,do_select,JOIN::exec,mysql_select,handle_select,execute_sqlcom_select,mysql_execute_command,mysql_parse,dispatch_command,do_handle