Skip to content

Instantly share code, notes, and snippets.

View amusarra's full-sized avatar

Antonio Musarra amusarra

View GitHub Profile
@baxtheman
baxtheman / adt.ftl
Created August 19, 2019 12:17
Liferay 7, asset publisher ADT, list preferences and variables context
<div>
<pre>
<#list portletPreferences?keys as preference>
<#if portletPreferences[preference] ??>
<#assign mapValues = portletPreferences[preference] />
<#list mapValues as value >
${preference} = ${value}<br />
</#list>
</#if>
</#list>
export TERM="xterm-256color" # This sets up colors properly
# workaround as per https://superuser.com/questions/1222867/zsh-completion-functions-broken
FPATH=$HOME/.oh-my-zsh/plugins/git:$HOME/.oh-my-zsh/functions:$HOME/.oh-my-zsh/completions:/usr/share/zsh/site-functions:/usr/share/zsh/$ZSH_VERSION/functions
export FPATH
# set shell
export SHELL=/usr/bin/zsh
@bouroo
bouroo / thai-id-card.py
Last active October 31, 2023 03:24
Thai National ID Card reader in python
#!/usr/bin/env python
# Kawin Viriyaprasopsook<kawin.v@kkumail.com>
# 2023-10-19
# sudo apt-get -y install pcscd python-pyscard python-pil
import binascii
import os
import sys
from PIL import Image
from smartcard.System import readers
@alivesay
alivesay / apache-multi-ad-reverse-proxy.conf
Created April 6, 2017 22:44
Apache reverse proxy with LDAP authentication against multiple Active Directory domains
<AuthnProviderAlias ldap auth1>
AuthLDAPURL "ldaps://auth1.example.com:636/DC=example,DC=com?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN "ldap_query"
AuthLDAPBindPassword "password"
</AuthnProviderAlias>
<AuthnProviderAlias ldap auth2>
AuthLDAPURL "ldaps://auth2.example.com:636/DC=example,DC=com?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN "ldap_query"
AuthLDAPBindPassword "password"
@mpern
mpern / OnRequestScript.groovy
Last active September 21, 2020 22:48
Simulate HTTP Auth for SOAP UI Mock Server
import com.eviware.soapui.support.types.StringToStringsMap
def authSucceeded = false
// Add those custom properties to your mock server
def user = mockRunner.mockService.getPropertyValue("httpUsername")
def pass = mockRunner.mockService.getPropertyValue("httpPassword")
log.info "checking for credentials: $user:$pass"
// get the request headers
StringToStringsMap headers = mockRequest.getRequestHeaders()
@olih
olih / jq-cheetsheet.md
Last active April 18, 2024 17:56
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active April 18, 2024 21:00
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@milendyankov
milendyankov / DXP70-runSQL.groovy
Last active May 12, 2023 11:20
Running SQL queries from liferay's groovy console
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import com.liferay.portal.kernel.dao.jdbc.DataAccess;
Connection con = null;
Statement st = null;
@nickrouty
nickrouty / gist:52269b159bd283710830
Last active August 29, 2015 14:02
Install PHP IMAP Extension for OSX Mavericks
#!/bin/bash
BUILDDIR=/tmp/php_imap_mavericks
mkdir "$BUILDDIR"
echo " "
echo "= FETCHING AND INSTALLING IMAP"
echo " "
cd "$BUILDDIR"
wget -c ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz
rm -rf imap-2007f
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active April 16, 2024 16:36
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository