Skip to content

Instantly share code, notes, and snippets.

@helix84
helix84 / AboutPage.java
Created June 15, 2012 23:18 — forked from peterdietz/dspace-add-about.diff
DSpace adding a java page to /about
/**
* AboutPage.java
*
* Basead on the code by Peter Dietz:
* https://gist.github.com/842301#file_dspace_add_about.diff (acessed 11-05-23)
*
* Modified to work with internationalization (i18n locales) and breadcrumbs
* by Andre Nito Assada e Josi Perez Alvarez on 11-05-23
*/
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import requests
import json
import xml.etree.ElementTree as ElementTree
from javax.servlet.http import HttpServlet
class ImpactServlet(HttpServlet):
#!/bin/bash
# Don't put duplicate lines in the history
export HISTCONTROL=ignoredups
# Store a lot history entries in a file for grep-age
shopt -s histappend
export HISTFILE=~/long_history
export HISTFILESIZE=50000
@helix84
helix84 / VBOX_E_INVALID_VM_STATE.md
Created June 20, 2016 14:37 — forked from hsiboy/VBOX_E_INVALID_VM_STATE.md
rescue a VM from VBOX_E_INVALID_OBJECT_STATE

#Issue

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
@helix84
helix84 / compiled_file_python_version.py
Last active July 28, 2016 21:48 — forked from delimitry/compiled_file_python_version.py
Get the version of Python by which the file was compiled
#!/usr/bin/env python
# -*- coding: utf8 -*-
import os
import sys
import struct
magics = {
20121: 'Python 1.5.x',
50428: 'Python 1.6',
@helix84
helix84 / .odbc.ini
Created August 20, 2018 15:00 — forked from lbolla/.odbc.ini
[MyDB]
Description = My Database
Driver = FreeTDS
Servername = W7WS6CL832J # MSSQL server name
Database = mydb
UID = username
PWD = password
Port = 1433
Charset = UTF-8
@helix84
helix84 / timed_cache.py
Last active December 12, 2022 06:49 — forked from jmdacruz/timed_cache.py
Python lru_cache with timeout
from datetime import datetime, timedelta
import functools
def timed_cache(**timedelta_kwargs):
def _wrapper(f):
maxsize = timedelta_kwargs.pop('maxsize', 128)
typed = timedelta_kwargs.pop('typed', False)
update_delta = timedelta(**timedelta_kwargs)
@helix84
helix84 / README-setup-tunnel-as-systemd-service.md
Created January 7, 2019 19:32 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/[email protected]. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@helix84
helix84 / LdapAuth.java
Created October 8, 2019 13:53 — forked from jbarber/LdapAuth.java
LDAP example for searching and simple binding (authentication)
/*
* First create the keystore (to allow SSL protection) by importing the LDAP
* certificate (cert.pem) with:
* keytool -import -keystore keystore -storepass changeit -noprompt -file cert.pem
*
* You can get the certificate with OpenSSL:
* openssl s_client -connect ldap.server.com:636 </dev/null 2>/dev/null | sed -n '/^-----BEGIN/,/^-----END/ { p }' > cert.pem
*
* Then compile this class with:
* javac LdapAuth.java