Skip to content

Instantly share code, notes, and snippets.

View brutuscat's full-sized avatar

Mauro Asprea brutuscat

View GitHub Profile
@zhzhxtrrk
zhzhxtrrk / wiki.lua
Last active April 19, 2020 18:31
pandoc confluence markup writer
-- that is very similar to that of pandoc's HTML writer.
-- There is one new feature: code blocks marked with class 'dot'
-- are piped through graphviz and images are included in the HTML
-- output using 'data:' URLs.
--
-- Invoke with: pandoc -t sample.lua
--
-- Note: you need not have lua installed on your system to use this
-- custom writer. However, if you do have lua installed, you can
-- use it to test changes to the script. 'lua sample.lua' will
@slagdang
slagdang / enable_trim.sh
Last active December 10, 2015 19:58 — forked from woods/enable_trim.sh
This script will enable TRIM support for 3rd Party SSDs on Mountain Lion and later. It will enable TRIM for ALL 3rd Party SSDs, so if you have two SSDs in your system, best be sure both support TRIM before running this. It is unclear if this patch also enables TRIM for rotational media, I'd have to look at the Darwin source to find that out.
#!/bin/bash
#
# Enable TRIM support for 3rd Party SSDs. Works for Mountain Lion, should work on earlier OSes too.
# Tested on 10.8.2, 10.8.3, 10.8.5, 10.9.0-10.9.5, 10.10.0-10.10.1, 10.10.4
#
# Run this script at your own risk, whether on 10.10 or earlier.
#
# This script works on MacOS 10.10-10.10.1 (Yosemite) but it has significant system security repercussions.
# To use it you must disable kext signing on your machine. This makes it easier for
# malware to infect your machine by disabling the feature which would detect unsigned
@mscoutermarsh
mscoutermarsh / application.rb
Created December 15, 2012 18:35
CORS - rails/grape
# Add this to your application.rb
config.middleware.use Rack::Cors do
allow do
origins '*'
# location of your API
resource '/api/*', :headers => :any, :methods => [:get, :post, :options, :put]
end
end
@mudge
mudge / gist:4111082
Created November 19, 2012 14:53
Capistrano task to use relative symlinks instead of absolute.
require "pathname"
namespace :deploy do
task :create_symlink, :except => { :no_release => true } do
deploy_to_pathname = Pathname.new(deploy_to)
on_rollback do
if previous_release
previous_release_pathname = Pathname.new(previous_release)
relative_previous_release = previous_release_pathname.relative_path_from(deploy_to_pathname)
@woods
woods / enable_trim.sh
Created August 12, 2012 20:19
Enable TRIM support for 3rd Party SSDs. Works for Mountain Lion.
#!/bin/bash
#
# Enable TRIM support for 3rd Party SSDs. Works for Mountain Lion
#
# Source: http://digitaldj.net/2011/07/21/trim-enabler-for-lion/
set -e
set -x
# Back up the file we're patching
@fousa
fousa / content.rb
Created July 12, 2012 15:09
Devise Generate Token
Devise.friendly_token
@johnkary
johnkary / WSSoapClient.php
Created June 27, 2012 20:08
WS-Security for PHP SoapClient
<?php
/**
* Copyright (c) 2007, Roger Veciana
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
@ashleydw
ashleydw / PostProcess.php
Created October 18, 2011 09:04
Zend Framework Controller Plugin to allow post output processing
<?php
/**
* Zend Framework Controller Plugin to allow post output processing
*
* @version 1
* @author Ashley White, http://www.needathinkle.com/
* @license http://creativecommons.org/licenses/by-sa/3.0/
*/
final class Thinkle_Controller_Plugin_PostProcess extends Zend_Controller_Plugin_Abstract {
@NuarHaruha
NuarHaruha / blogspot-template.xml
Created September 10, 2011 18:21
SEO friendly TITLE for blogspot.com
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<title><data:blog.title/> - blog description </title>
<b:else/>
<b:if cond='data:blog.pageType == &quot;index&quot;'>
<title><data:blog.pageName/> - <data:blog.title/> - blog description </title>
<b:else/>
<b:if cond='data:blog.pageType == &quot;static_page&quot;'>
<title><data:blog.pageName/> - <data:blog.title/></title>
<b:else/>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
@brutuscat
brutuscat / ExceptionThrower.php
Created February 17, 2011 09:38
Utility for catching PHP errors, warnings and notices, then converting them (throwing) to an exception that can be caught at runtime @author Jason Hinkle - http://verysimple.com/2010/11/02/catching-php-errors-warnings-and-notices/ @copyright 1997-20
<?php
/**
* Utility for catching PHP errors and converting them to an exception
* that can be caught at runtime
* @author Jason Hinkle
* @copyright 1997-2011 VerySimple, Inc.
* @license http://www.gnu.org/licenses/lgpl.html LGPL
* @version 1.0
*/
class ExceptionThrower