Skip to content

Instantly share code, notes, and snippets.

View vhyza's full-sized avatar

Vojtěch Hýža vhyza

View GitHub Profile
@karmi
karmi / slingshot.rb
Created February 6, 2011 14:17
Sketch of a Ruby API for ElasticSearch [http://elasticsearch.com]
# Sketch of a Ruby API for ElasticSearch [http://elasticsearch.com]
require 'rubygems'
require 'curb'
require 'rest_client'
require 'yajl/json_gem'
module Slingshot
def http
@karmi
karmi / README.markdown
Last active January 9, 2016 18:06
NYT ISIS Attacks Chart
@karmi
karmi / mac_os_setup.sh
Created December 19, 2010 13:43
Installation Instructions For Setting Up A Clean Mac OS X System
# =====================================================
# Installation instructions for a clean Mac OS X system
# =====================================================
#
# <https://gist.github.com/747336>
#
# Keep only `.ssh` and `.profile.local` files from backup
# + Clean up Apple Ruby
@cool-Blue
cool-Blue / data.js
Last active October 26, 2017 08:43
canvas-based-wind-with-d3
dispatch.data([{"12":0.461,"id":1001,"04":0.52,"08":0.478,"x":-86.641,"y":32.539},{"12":0.558,"id":1003,"04":0.539,"08":0.514,"x":-87.725,"y":30.743},{"12":-0.029,"id":1005,"04":0.099,"08":0.015,"x":-85.392,"y":31.877},{"12":0.468,"id":1007,"04":0.445,"08":0.458,"x":-87.128,"y":33},{"12":0.741,"id":1009,"04":0.625,"08":0.695,"x":-86.567,"y":33.983},{"12":-0.528,"id":1011,"04":-0.364,"08":-0.484,"x":-85.716,"y":32.106},{"12":0.075,"id":1013,"04":0.186,"08":0.134,"x":-86.685,"y":31.758},{"12":0.32,"id":1015,"04":0.326,"08":0.325,"x":-85.825,"y":33.776},{"12":0.051,"id":1017,"04":0.175,"08":0.085,"x":-85.39,"y":32.92},{"12":0.55,"id":1019,"04":0.319,"08":0.512,"x":-85.6,"y":34.176},{"12":0.603,"id":1021,"04":0.542,"08":0.578,"x":-86.718,"y":32.855},{"12":0.046,"id":1023,"04":0.082,"08":0.074,"x":-88.263,"y":32.023},{"12":0.083,"id":1025,"04":0.185,"08":0.116,"x":-87.827,"y":31.685},{"12":0.457,"id":1027,"04":0.415,"08":0.473,"x":-85.862,"y":33.275},{"12":0.682,"id":1029,"04":0.514,"08":0.624,"x":-85.52,"y":33.67
.DS_Store
tmp/*
@karmi
karmi / nginx-elasticsearch-proxy.conf
Created May 23, 2011 08:16
Route requests to ElasticSearch to authenticated user's own index with an Nginx reverse-proxy
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost:8080/_search?q=*
#
# is rewritten to:
#
@dhh
dhh / tracker_blocking.rb
Last active July 27, 2023 14:19
Current list of spy pixels named'n'shamed in HEY, as of April 23, 2020
module Entry::TrackerBlocking
extend ActiveSupport::Concern
included do
has_many :blocked_trackers
end
email_service_blockers = {
"ActiveCampaign" => /lt\.php(.*)?l\=open/,
"AWeber" => "openrate.aweber.com",
@karmi
karmi / elastic_search_ngram_analyzer_for_urls.sh
Created May 24, 2011 15:32
NGram Analyzer in ElasticSearch
# ========================================
# Testing n-gram analysis in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/ngram_test
curl -X PUT localhost:9200/ngram_test -d '
{
"settings" : {
"index" : {
"analysis" : {
@fernandoaleman
fernandoaleman / mysql2-apple-silicon-macos-sonoma.md
Created November 2, 2023 16:32
How to install mysql2 gem on apple silicon M1, M2 or M3 macOS Sonoma

Problem

Installing mysql2 gem errors on Apple silicon M1, M2 or M3 Mac running macOS Sonoma.

Solution

Make sure mysql-client, openssl and zstd are installed on Mac via Homebrew.

Replace mysql-client with whichever mysql package you are using