Skip to content

Instantly share code, notes, and snippets.

View jnbdz's full-sized avatar
👨‍💻
None stop

JN Σ jnbdz

👨‍💻
None stop
View GitHub Profile
@jnbdz
jnbdz / gist:1384192
Created November 21, 2011 22:33
Great way to encrypt and decrypt files with AES-256 with CBC mode. Made for Kohana framework (controller).
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Filemanager extends Controller {
private $file = '/var/www/assets/img/big/IMG_2083.JPG';
private $new_file = '/var/www/assets/encrypt/';
private $key = 'your key';
private $cipher = MCRYPT_RIJNDAEL_256;
private $mode = MCRYPT_MODE_CBC;
@jnbdz
jnbdz / gist:4464264
Last active December 10, 2015 16:58
Small script to test webworker postMessage.
self.addEventListener('message', function(e) {
self.postMessage(e.data);
}, false);
@jnbdz
jnbdz / gist:7624654
Created November 24, 2013 08:05
League OAuth2 - DropBox
<?php
namespace League\OAuth2\Client\Provider;
use League\OAuth2\Client\Token\AccessToken;
class DropBox extends IdentityProvider
{
public function urlAuthorize()
@jnbdz
jnbdz / gist:69ea50f8fa8a5a43af6e
Created December 3, 2014 19:17
Detect image format webp support.
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
set nocompatible
syntax on
set relativenumber
set number
command W :execute ':silent w !sudo tee % > /dev/null' | :edit!
command Unsetnum :execute ':set relativenumber& | set number&'
command Resetnum :execute ':set relativenumber | set number'
set backspace=2 " make backspace work like most other apps (http://vim.wikia.com/wiki/Backspace_and_delete_problems)
set viminfo='10,\"100,:20,%,n~/.viminfo
function! ResCur()
#! /bin/bash
#
# This script needs "fpm". If you dont have it,
# run "gem install fpm"
#
# You also need to "apt-get install python-setuptools" (otherwise fpm fails)
clean() {
rm -rf whisper-0.9.9 carbon-0.9.9 graphite-web-0.9.9
# First do a fresh install of CentOS 5.7 i386, server configuration (no GUI)
# This should be performed as root since it's going to be installing a bunch of stuff
# --- Update things to make sure we have the latest patches ---
# Add EPEL so we can get reasonably recent packages
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# --- Install all the packages --- #
yum -y install python-whisper python-carbon graphite-web python-memcached python-ldap httpd memcached
@jnbdz
jnbdz / munin-graphite.rb
Last active August 29, 2015 14:26 — forked from sentinelleader/munin-graphite.rb
munin-graphite
#!/usr/bin/env ruby
#
# graphite-mdash client - build ontop of munin-graphite
#
# Copyright: Copyright (c) 2012, Jonas Genannt <jonas@brachium-system.net>
#
# Author:: Adam Jacob (<adam@hjksolutions.com>)
# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
# License:: GNU General Public License version 2 or later
#
@jnbdz
jnbdz / rmq-publish-with-header.c
Last active August 29, 2015 14:26 — forked from sentinelleader/rmq-publish-with-header.c
rmq-publish-with-header.c for Mosquitto MQTT broker
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <clem_rmq.h>
#include <assert.h>
#include <amqp_tcp_socket.h>
#include <amqp.h>
@jnbdz
jnbdz / riemann.js
Last active August 29, 2015 14:26 — forked from sentinelleader/riemann.js
/*
*
* To enable this backend, include './backends/riemann' in the backends
* configuration array:
*
* Requires Riemann Node client
*
* backends: ['./backends/riemann']
*
*/