Skip to content

Instantly share code, notes, and snippets.

View chrishein's full-sized avatar

Christian Hein chrishein

View GitHub Profile
@chrishein
chrishein / Recipe-bundling-fonts-with-headless-chrome.md
Created June 25, 2018 15:04 — forked from nat-n/Recipe-bundling-fonts-with-headless-chrome.md
How to build a fontconfig bundle for adding arbitrary fonts to headless chrome independent of the OS. This is specifically useful for deploying headless chrome to AWS lambda where it is necessary to include fonts for rendering CJK (Chinese, Japanese, Korean) characters into the deployed bundle.

Building fontconfig

Start up a lambda-like docker container:

docker run -i -t -v /tmp:/var/task lambci/lambda:build /bin/bash

Install some dependencies inside the container:

yum install gperf freetype-devel libxml2-devel git libtool -y

easy_install pip

@chrishein
chrishein / delete_files_older_than_30_days.json
Created March 16, 2017 21:04
Google Cloud Storage - Lifecycle
{
"lifecycle": {
"rule": [
{
"action": {
"type": "Delete"
},
"condition": {
"age": 30,
"isLive": true
@chrishein
chrishein / bora.py
Last active July 2, 2017 23:35
BORA (Boletín Oficial de la Republica Argentina) Crawler implemented using Scrapy.
# -*- coding: utf-8 -*-
import datetime
import json
import re
import urllib
import scrapy
from bs4 import BeautifulSoup
from datetime import date
@chrishein
chrishein / gist:fbca665930b7f20e64a1
Last active August 29, 2015 14:06
Get bash for AMD64 machines from Ubuntu trusty (14.04LTS) packages for installing to other EOL versions (such as 13.10). CVE-2014-6271
# http://packages.ubuntu.com/trusty/bash
# Check dependencies versions
dpkg -s dash | grep Version
dpkg -s libc6 | grep Version
dpkg -s base-files | grep Version
dpkg -s debianutils | grep Version
dpkg -s bash-completion | grep Version
# Download and install
# These instructions were tested on Ubuntu 12.04 64bit
# Be prepared to wait a while...
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev libxext-dev libpq-dev libx11-dev
git clone git://github.com/antialize/wkhtmltopdf.git
git clone git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git wkhtmltopdf-qt
cd wkhtmltopdf
mkdir static-build
ln -s ../wkhtmltopdf-qt static-build/qt
./scripts/static-build.sh
@chrishein
chrishein / ssh
Created June 14, 2013 22:39
Change Terminal.app Profile when connecting through ssh according to server
#!/bin/sh
# Place this script in your path before /usr/local/bin . Make it executable
# If using .ssh/config to define username. "ssh server1"
HOSTNAME=$@
# If connecting using "ssh user1@server1"
# HOSTNAME=`echo $@ | sed s/.*@//`
@chrishein
chrishein / Main_part.xml
Created August 16, 2011 14:59
JRapid BI simple example
<entity label="Store" menu="Menu" name="Store">
<property display="primary" label="Name" name="name"/>
</entity>
<entity crosstab="crosstab" label="Sale" menu="Menu" name="Sale">
<property dimension="row" display="primary" label="Sale Date" name="saleDate" type="date"/>
<property dimension="column" display="primary" entity="Store" label="Store" name="store"/>
<property display="primary" label="Total Amount" name="totalAmount" type="double"/>
<property childproperty="sale" collection="set" embedded="inline" entity="SaleDetail" extendable="extendable" label="Detail" name="lines"/>
</entity>
@chrishein
chrishein / jrapid_example.xml
Created August 3, 2011 13:23
JRapid Combo property and dynamicvalue example
<entity label="Company" name="Company">
<property display="primary" label="Name" name="name"/>
<filter display="primary" label="Name" name="name" property="name"/>
<property label="Address" name="address" type="text"/>
<property label="Default For Data Field 1" name="defaultForDataField1"/>
<property label="Default For Data Field 2" name="defaultForDataField2"/>
</entity>
<entity label="Invoice" menu="Menu" name="Invoice">
<property display="primary" label="Invoice Date" name="invoiceDate" type="date" widget="jdatepicker"/>