Skip to content

Instantly share code, notes, and snippets.

View sevein's full-sized avatar

Jesús García Crespo sevein

View GitHub Profile
@sevein
sevein / gist:1456441
Created December 10, 2011 21:14
Change connection character set to utf8
Index: archivematicaCommon/lib/databaseInterface.py
===================================================================
--- archivematicaCommon/lib/databaseInterface.py (revision 2013)
+++ archivematicaCommon/lib/databaseInterface.py (working copy)
@@ -32,6 +32,8 @@
global separator
separator = "', '"
+DB_CONNECTION_OPTS = dict(db="MCP", read_default_file="/etc/archivematica/archivematicaCommon/dbsettings", charset="utf8")
+
@sevein
sevein / private.xml
Created December 30, 2011 05:48
KeyRemap4MacBook config file to make the backslash available in my keyboard from USA (using SPANISH_ISO in OSX).
<?xml version="1.0"?>
<root>
<item>
<name>get_backslash_spanish_keyboard</name>
<inputmodedetail_only>SPANISH_ISO</inputmodedetail_only>
<identifier>private.get_backslash_spanish_keyboard</identifier>
<autogen>--KeyToKey-- KeyCode::SPANISH_LESS_THAN, ModifierFlag::OPTION_R, KeyCode::SPANISH_ORDINAL_INDICATOR, ModifierFlag::OPTION_R</autogen>
</item>
</root
@sevein
sevein / share.diff
Created January 4, 2012 22:53
(de/un)capitalize
Index: src/MCPServer/share/mysql
===================================================================
--- src/MCPServer/share/mysql (revision 2275)
+++ src/MCPServer/share/mysql (working copy)
@@ -48,7 +48,7 @@
set @organizationAgent = 2;
INSERT INTO Agents (pk, agentIdentifierType, agentIdentifierValue, agentName, agentType)
VALUES (@archivematicaAgent, 'preservation system', 'Archivematica-0.8', 'Archivematica', 'software'),
- (@organizationAgent, 'repository code', 'ORG', 'Your Organization Name Here', 'organization')
+ (@organizationAgent, 'repository code', 'ORG', 'Your organization name here', 'organization')
@sevein
sevein / resetPasswordTask.class.php
Created January 10, 2012 20:41
Symfony task in Qubit to reset user passwods
<?php
/*
* This file is part of Qubit Toolkit.
*
* Qubit Toolkit is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@sevein
sevein / qubit_dev.php.patch
Created January 11, 2012 18:16
Add another IP address to local ACL
Index: www/qubit-toolkit-svn/qubit_dev.php
===================================================================
--- www/qubit-toolkit-svn/qubit_dev.php (revision 10638)
+++ www/qubit-toolkit-svn/qubit_dev.php (working copy)
@@ -2,7 +2,7 @@
// this check prevents access to debug front controllers that are deployed by accident to production servers.
// feel free to remove this, extend it or make something more sophisticated.
-if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))
+if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1', '192.168.1.10')))
@sevein
sevein / migrate-1.2.0.patch
Created January 13, 2012 07:11
Set data version
Index: lib/task/migrate/MigrateTask.class.php
===================================================================
--- lib/task/migrate/MigrateTask.class.php (revision 10579)
+++ lib/task/migrate/MigrateTask.class.php (working copy)
@@ -204,6 +204,8 @@
$dir = dirname($originalFileName);
$migratedFileName = $dir.DIRECTORY_SEPARATOR.$migratedFileName;
+ $this->setDataVersion();
+
@sevein
sevein / qubit-1.2-issue-2219.patch
Created January 13, 2012 19:38
Fix for issue 2219, change regular expression to capture ID properly
Index: apps/qubit/modules/contactinformation/actions/editComponent.class.php
===================================================================
--- apps/qubit/modules/contactinformation/actions/editComponent.class.php (revision 10667)
+++ apps/qubit/modules/contactinformation/actions/editComponent.class.php (working copy)
@@ -119,7 +119,7 @@
{
if (isset($item['id']))
{
- $this->contactInformation = QubitContactInformation::getById(preg_replace('/^(.*)(\d+)$/', '$2', $item['id']));
+ $this->contactInformation = QubitContactInformation::getById(preg_replace('/^.*\/(\d+)$/', '$1', $item['id']));
@sevein
sevein / sql_debug.patch
Created May 18, 2012 21:53
SQL debug for Qubit
Index: vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel/util/BasePeer.php
===================================================================
--- vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel/util/BasePeer.php
+++ vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel/util/BasePeer.php
@@ -283,7 +283,7 @@
$sql = 'INSERT INTO ' . $tableName
. ' (' . implode(',', $columns) . ')'
. ' VALUES (';
- // . substr(str_repeat("?,", count($columns)), 0, -1) .
+ // . substr(str_repeat("?,", count($columns)), 0, -1) .
<?php
/*
* This file is part of Qubit Toolkit.
*
* Qubit Toolkit is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@sevein
sevein / nested_set.php
Created June 21, 2012 22:07
Extra NestedSet functionality
<?php
/**
* Extra operations for nested sets
*/
public function moveToPrevSiblingOf($sibling, PropelPDO $con = null)
{
/*
if (!$this->isInTree())