Skip to content

Instantly share code, notes, and snippets.

@moneytoo
moneytoo / gist:8c95cc39fd4fd9a18858eb15e379d2f5
Last active Jun 26, 2020
ImageMagick 6.7.8 with WebP (libwebp) support on CentOS 7
View gist:8c95cc39fd4fd9a18858eb15e379d2f5
yum -y install bzip2-devel libtiff-devel giflib-devel ghostscript-devel libwmf-devel jasper-devel libtool-ltdl-devel libXext-devel libXt-devel librsvg2-devel OpenEXR-devel libwebp-devel
rpm -ivh http://vault.centos.org/centos/7/updates/Source/SPackages/ImageMagick-6.7.8.9-15.el7_2.src.rpm
sed -i '/BuildRequires:\tghostscript-devel/a BuildRequires:\tlibwebp-devel' /root/rpmbuild/SPECS/ImageMagick.spec
sed -i '/Requires: pkgconfig/a Requires: libwebp' /root/rpmbuild/SPECS/ImageMagick.spec
rpmbuild -ba /root/rpmbuild/SPECS/ImageMagick.spec
# actual install
rpm -Uvh --force /root/rpmbuild/RPMS/x86_64/ImageMagick-6.7.8.9-15.el7.centos.x86_64.rpm
@moneytoo
moneytoo / gist:ab3f34e4fddc2110675952f8280f49c5
Last active Mar 22, 2020
nginx with OpenSSL 1.0.2 (ALPN) on CentOS 7, also available from https://brouken.com/brouken-centos-7-repo/
View gist:ab3f34e4fddc2110675952f8280f49c5
### No longer needed as of nginx-1.13.6-1.el7_4.ngx.x86_64.rpm from nginx.org
### it was compiled against OpenSSL 1.0.2 from CentoOS 7.4 so it supports ALPN (HTTP2 works)
yum -y groupinstall 'Development Tools'
yum -y install wget openssl-devel libxml2-devel libxslt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel rpmdevtools
OPENSSL="openssl-1.0.2l"
NGINX_VERSION="1.13.5-1"
NJS_VERSION="1.13.5.0.1.13-1"
View gist:86c6ae5c7f888b9320a4
07-23 20:34:33.725 1257-1758/? D/PowerManagerNotifier﹕ onUserActivity: event=2, uid=1000
07-23 20:34:33.731 1257-1758/? E/qdlights﹕ set_light_buttons enter:
07-23 20:34:33.732 1257-1758/? E/qdlights﹕ set_light_buttons done:
07-23 20:34:33.810 2308-2308/? I/Timeline﹕ Timeline: Activity_launch_request id:com.google.samples.apps.cardboarddemo time:170797
07-23 20:34:33.812 1257-2114/? V/ActivityManager﹕ notify app switch for new activity com.google.samples.apps.cardboarddemo Where 1
07-23 20:34:33.813 1257-2114/? I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.google.samples.apps.cardboarddemo/com.google.vr.cardboard.paperscope.carton.Home2D (has extras)} from uid 10109 on display 0
07-23 20:34:33.814 1257-2114/? I/Configuration﹕ Configuration getConfigurationFromSysProp name= persist.sys.font_scale value=
07-23 20:34:33.814 1257-2114/? I/Configuration﹕ Configuration getConfigurationFromSysProp name= persist.sys.fon
View regex-weburl.js
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@moneytoo
moneytoo / gist:87e3772c821cb1e86415
Created May 23, 2015
Efficiently invert bitmap on Android
View gist:87e3772c821cb1e86415
public Bitmap invert(Bitmap src)
{
int height = src.getHeight();
int width = src.getWidth();
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
ColorMatrix matrixGrayscale = new ColorMatrix();
@moneytoo
moneytoo / gist:8446716
Created Jan 15, 2014
msol2png - converting images in MSOL format (6-bit color depth) to PNG. Used by Qualcomm Toq (Mirasol display).
View gist:8446716
import java.awt.Color;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import javax.imageio.ImageIO;
// WARNING: DIRTY CODE
public class msol2png {
You can’t perform that action at this time.