Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Git KiCad library repos:
#
# The "install_prerequisites" step is the only "distro dependent" one. Could modify
# that step for other linux distros.
# This script requires "git". The package bzr-git is not up to the task.
# The first time you run with option --install-or-update that is the slowest, because
# git clone from github.com is slow.
# After that updates should run faster.
#!/bin/sh
wget -q --mirror -p --html-extension -e robots=off --base=./ -k -P ./ http://<origin>
find ./<origin>/ -type f -print0 | xargs -0 sed -i 's/<origin>/<destination>/g'
@imr
imr / Git Mirror
Last active August 29, 2015 14:22
git clone --mirror https://<repo-to-mirror>.git
cd <repo-to-mirror>.git
git remote set-url --push gitlab <new path>
git fetch -q
git push -q --mirror gitlab
@imr
imr / gist:4027516
Created November 6, 2012 21:03
Imap_Client with Archiveopteryx 3.1.3
-----------------------------
>> Tue, 06 Nov 2012 21:35:59 +0000
S: * OK [CAPABILITY IMAP4rev1 AUTH=CRAM-MD5 AUTH=PLAIN COMPRESS=DEFLATE ENABLE ID LITERAL+ SASL-IR STARTTLS] hot-rain.com Archiveopteryx IMAP Server
C: 1 AUTHENTICATE CRAM-MD5
S: + PGpOYk4welZCb04wYzRPU3BAaG90LXJhaW4uY29tPg==
C: [CRAM-MD5 Response]
S: 1 OK [CAPABILITY IMAP4rev1 ACL ANNOTATE-EXPERIMENT-1 BINARY CATENATE CHILDREN COMPRESS=DEFLATE CONDSTORE ENABLE ESEARCH I18NLEVEL=1 ID IDLE LIST-EXTENDED LITERAL+ MULTIAPPEND NAMESPACE RIGHTS=ekntx SORT SORT=DISPLAY STARTTLS UIDPLUS UNSELECT URLAUTH WITHIN] done
C: 2 LIST (SUBSCRIBED) "" ("*" "/users/*" "/*") RETURN (SUBSCRIBED)
S: * LIST (\hasnochildren \subscribed) "/" Archive
S: * LIST (\hasnochildren \subscribed) "/" Drafts
@imr
imr / gist:3154317
Created July 21, 2012 02:49
Horde forked cli with database
#!/usr/bin/env php
<?php
$baseFile = __DIR__ . '/../lib/Application.php';
if (file_exists($baseFile)) {
require_once $baseFile;
}
Horde_Registry::appInit(<app>, array('authentication' => false, 'cli' => true));
$driver = $GLOBALS['injector']->getInstance('<app>_Factory_Driver')->create();
@imr
imr / gist:2499324
Created April 26, 2012 12:46
Drupal 6 code needing conversion to Drupal 7
<?php
if (arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) {
$node = node_load(arg(1));
if ($node->field_related_msds[0]['nid']) {
foreach ($node->field_related_msds as $msds_node_reference) {
$msds_node = node_load($msds_node_reference['nid']);
echo theme('filefield_file', $msds_node->field_msds[0]);
}
} else {
echo "none posted for this product.";