Skip to content

Instantly share code, notes, and snippets.

View fedecarg's full-sized avatar
🥄
There is no spoon

Federico Cargnelutti fedecarg

🥄
There is no spoon
View GitHub Profile
@fedecarg
fedecarg / svnlog-ldap-extractname.sh
Created March 7, 2013 11:52
Replace LDAP entries with full names in SVN log
#!/bin/bash
# Author [email protected]
svn_url="$(svn info . | grep 'URL:' | cut -c6-)"
echo "Repository ${svn_url}"
svn log -v --xml . > templog.log
touch svnlog.log
@fedecarg
fedecarg / python-interceptor.md
Last active June 12, 2022 03:23
Intercepting class method invocations using metaclass programming in Python

Intercept class method calls

Here’s an example of how to use metaclass programming to intercept class method calls similar to the method_missing technique in Ruby:

class ClassMethodInterceptor(type):

    def __getattr__(cls, name):
        return lambda *args, **kwargs: \
                   cls.static_method_missing(name, *args, **kwargs)
@fedecarg
fedecarg / mysql-split-string.md
Last active October 22, 2018 12:33
MySQL Split String Function

MySQL Split String Function

The following example function takes 3 parameters, performs an operation using an SQL function, and returns the result.

Function

CREATE FUNCTION SPLIT_STR(
  x VARCHAR(255),
  delim VARCHAR(12),

pos INT