Skip to content

Instantly share code, notes, and snippets.

View informz's full-sized avatar

Stephen Ball informz

View GitHub Profile
@informz
informz / gist:7490324
Created November 15, 2013 19:37
IText JRuby Integration
require 'java'
require 'itext'
java_import com.lowagie.text.Document
java_import com.lowagie.text.PageSize
java_import com.lowagie.text.pdf.PdfPCell
java_import com.lowagie.text.pdf.PdfPTable
java_import com.lowagie.text.pdf.PdfWriter
java_import java.lang.String
java_import java.io.FileOutputStream
@informz
informz / gist:5c728bfdb515b6e3cbad
Last active August 29, 2015 14:23
potential resource cleanup code
hook = java.lang.Thread.new do
# puts '[DEBUG] shutdown hook'
# java.lang.Thread.get_all_stack_traces.key_set.each do | thread |
# puts '[DEBUG] stopping'
# begin
# thread.stop
# rescue java.lang.Throwable => t
# puts t
# end
@informz
informz / GRANTS_SYNONYMS
Last active August 29, 2015 14:23
GRANTS AND SYNONYMS
SELECT 'REVOKE '
|| privilege
|| ' ON "'
|| table_name
|| '" TO '
|| grantee
|| CASE
WHEN grantable = 'YES'
THEN ' WITH GRANT OPTION;'
ELSE ';'
(defproject lein1 "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[compojure "1.5.0"]
[ring "1.4.0"]
[com.h2database/h2 "1.4.187"]
[org.clojure/java.jdbc "0.6.1"]
@informz
informz / InventoryFetcher.scala
Created September 16, 2016 15:00
Fetches Inventory
import play.api.libs.json.Json
import play.api.libs.ws.ning.NingWSClient
import scala.concurrent.ExecutionContext.Implicits.global
/**
* Created by ball on 9/16/16.
*/
object InventoryFetcher {
### Keybase proof
I hereby claim:
* I am informz on github.
* I am s_ball (https://keybase.io/s_ball) on keybase.
* I have a public key ASB9Bxh_zrIvBszbDzDob4OBelPsL-ukJv9vgdugYnWq_go
To claim this, I am signing this object:
@informz
informz / client_module_insert.json
Last active October 2, 2017 16:42
Data Lake Config Proposal using EAV pattern
insert API request:
[
{
"entity" : "ssp_ratecard",
"attribute" : "calendar_period_id",
"bigint_value" : 34567,
"text_value" : null,
"double_value" : null,
"boolean_value" : null
@informz
informz / rest_on_oracle.sql
Last active October 4, 2017 17:10
rest_on_oracle
declare
l_url varchar2(100) := 'http://datamaker-stage.aoa.inbcu.com/data-maker/health';
l_req utl_http.req;
l_result utl_http.resp;
l_data varchar2(4000);
l_clob clob;
begin
dbms_lob.createtemporary(l_clob,true);
l_req := utl_http.begin_request(l_url);
l_result := utl_http.get_response(l_req);
@informz
informz / get_job_status.sh
Created April 19, 2018 12:32 — forked from arturmkrtchyan/get_job_status.sh
Apache Spark Hidden REST API
curl http://spark-cluster-ip:6066/v1/submissions/status/driver-20151008145126-0000
import org.scalatest.Matchers._
import org.scalatest.FlatSpec
/*
Implement the mean, median, mode and range methods in Java 8 Functional style with the minimum code necessary to pass the tests.
*/
class FunctionalTestSpec extends FlatSpec {
"A Range " should "have a value of 14" in {
assert(14 === range(3, 17, 15, 11, 9))
}
// range: the difference between min and max values