Skip to content

Instantly share code, notes, and snippets.

@noboomu
noboomu / naturalDimensions
Created April 2, 2015 15:50
Update dom with natural width and height of images.
[].forEach.call(document.querySelectorAll('img'),function(i)
{
i.setAttribute('data-natural-width',i.naturalWidth);
i.setAttribute('data-natural-height',i.naturalHeight);
})
@noboomu
noboomu / cmyk2rgb
Last active December 15, 2020 10:23
Imagemagick CMYK to RGB on OS X.
convert -profile "/System/Library/ColorSync/Profiles/sRGB Profile.icc" -colorspace RGB source.jpg destination.jpg
@noboomu
noboomu / CassandraSQLContextJava
Created April 2, 2015 15:59
Service class to access a Spark CassandraSQLContext from Java. Using DSE in this case.
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.cassandra.CassandraSQLContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/* This is simply a wrapper around Typedafe's config */
import utilities.Configuration;
public class SparkService
@noboomu
noboomu / ShutdownHook
Created April 2, 2015 16:01
Java shutdown hook example.
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable()
{
@Override
public void run()
{
System.out.println();
System.out.println("Exiting...");
}
}));
@noboomu
noboomu / # opencv3 - 2016-06-23_17-26-08.txt
Created June 24, 2016 19:40
opencv3 (homebrew/science/opencv3) on Mac OS X 10.11.4 - Homebrew build logs
Homebrew build logs for homebrew/science/opencv3 on Mac OS X 10.11.4
Build date: 2016-06-23 17:26:08
@noboomu
noboomu / deploy.sh
Created December 28, 2018 00:29
Container Deploy from S3 Script
#!/bin/bash
aws s3 cp s3://$BUCKET_NAME/$ARCHIVE_KEY .
echo "Extracting project"
DIRECTORY_NAME=`tar -tf $ARCHIVE_NAME | sed -e 's@/.*@@' | uniq`
tar -zxvf ./$ARCHIVE_NAME
@noboomu
noboomu / bin.xml
Last active December 28, 2018 00:43
Maven Executable Archive
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>bin</id>
<formats>
<format>tar.gz</format>
</formats>
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
@noboomu
noboomu / AwsRequestSigningInterceptor.java
Created August 23, 2019 05:34
Provide HttpRequestInterceptor for ElasticSearch RestClient Using aws-sdk-java-v2
import com.google.inject.Inject;
import com.google.inject.name.Named;
import org.apache.http.*;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.message.BasicHeader;
import org.apache.http.protocol.HttpContext;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.client.RequestOptions;
@noboomu
noboomu / SteamVR-2021-06-18-AM_08_38_51
Created June 18, 2021 15:44
SteamVR System Report Vive Pro 2
This file has been truncated, but you can view the full file.
SteamVR System Report created Fri Jun 18 08:36:23 2021
<Report>
SteamVR Version: 1.18.2 (1623790092)
SteamVR Date: 2021-06-15
Steam: Public
Steam Branch: beta
Steam AppID: 250820
Tracking: lighthouse
OS: Linux version 5.4.0-53-generic (buildd@lcy01-amd64-007) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #59-Ubuntu SMP Wed Oct 21 09:38:44 UTC 2020
@noboomu
noboomu / gist:771871fcb989c31bc231614beb6ce422
Last active November 7, 2024 01:48
Generate Multiple Renditions and LL-HLS Streams from Source MP4
#!/bin/bash
# arg 1 is filename arg 2 is output directory
FILENAME=$1
VIDEO_NAME=`echo "${FILENAME%.*}"`
echo "Generating renditions for $VIDEO_NAME"