Skip to content

Instantly share code, notes, and snippets.

sudo apt-get install libfakekey-dev libpng-dev libxft-dev autoconf libtool -y
sudo mkdir -p /usr/local/src/matchbox-keyboard
git clone https://github.com/xlab/matchbox-keyboard.git /usr/local/src/matchbox-keyboard
cd /usr/local/src/matchbox-keyboard && ./autogen.sh && make && sudo make install
sudo apt-get install libmatchbox1 -y
cat << EOF | sudo tee /usr/bin/toggle-matchbox-keyboard.sh
#!/bin/bash
#This script toggle the virtual keyboard

Keybase proof

I hereby claim:

  • I am mathewpeterson on github.
  • I am mathewpeterson (https://keybase.io/mathewpeterson) on keybase.
  • I have a public key whose fingerprint is DB70 A3E3 E399 1194 048B A2C2 EB4C AC07 EA86 56A9

To claim this, I am signing this object:

<?php
use \Imagine;
use Avalanche\Bundle\ImagineBundle\Imagine\Filter\Loader\LoaderInterface;
class ThumbnailFilterService implements LoaderInterface, Imagine\Filter\FilterInterface
{
const DEFAULT_WIDTH = 120;
const DEFAULT_HEIGHT = 120;
@mathewpeterson
mathewpeterson / remove-old-kernels.sh
Created August 5, 2013 15:26
This snippet will remove old kernel in ubuntu/debian
#!/bin/bash
# http://www.unixmen.com/remove-all-unused-kernels-with-1-command-in-debian-based-systems/
sudo apt-get remove $(dpkg -l|egrep '^ii linux-(im|he)'|awk '{print $2}'|grep -v `uname -r`)
function make_comparer() {
// Normalize criteria up front so that the comparer finds everything tidy
$criteria = func_get_args();
foreach ($criteria as $index => $criterion) {
$criteria[$index] = is_array($criterion)
? array_pad($criterion, 3, null)
: array($criterion, SORT_ASC, null);
}
return function($first, $second) use (&$criteria) {

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.
<?php
class MY_Controller extends CI_Controller
{
/**
* Takes the method passed to it for the router
* and loads a header and footer for all controller methods
* automatically setting an id and class for CSS Scoping
*
* @param string $method
@mathewpeterson
mathewpeterson / ip_range.php
Created April 5, 2012 16:06
This will generate an array of ip address
<?php
function ip_range($from, $to) {
$start = ip2long($from);
$end = ip2long($to);
$range = range($start, $end);
return array_map('long2ip', $range);
}
#!/usr/bin/perl -w
# 2/2000 krischan at jodies.cx
#
# 0.14 Release
# 0.14.1 Allow netmasks given as dotted quads
# 0.15 Colorize Classbits, Mark new bits in network
# 0.16 25.9.2000 Accept <addr>/<cidr> as first argument
# Print <pre> tag in the script
# 0.17 Bugfix