Skip to content

Instantly share code, notes, and snippets.

View ssx's full-sized avatar

Scott Robinson ssx

View GitHub Profile
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
# Download the compiled elasticsearch rather than the source.
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@FokkeZB
FokkeZB / share.js
Last active April 1, 2016 14:29
A simple example of using Android intents to share texts, URLs and files like you could do using 0x82's ShareKit module (https://marketplace.appcelerator.com/apps/741) or any other similar module (TiSocial: https://github.com/viezel/TiSocial.Framework) for iOS.
function share(options) {
if (OS_ANDROID) {
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_SEND
});
intent.putExtra(Ti.Android.EXTRA_SUBJECT, options.title);
@mstepanov
mstepanov / app.js
Created March 19, 2013 23:19
Titanium ListView Examples
var rootWin = Ti.UI.createWindow();
var navGroup = Ti.UI.iPhone.createNavigationGroup({
window: rootWin
});
var button = Ti.UI.createButton({
title: 'Open ListView Tests'
});
button.addEventListener('click', function() {
openTestsWindow();
});
@damienalexandre
damienalexandre / pony.sh
Created April 15, 2013 09:13
Facets example with ElasticSearch. Building a Filtered Query manualy (or via Elastica) is hell.
# for real, I have a mapping and my color is not "indexed"
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d '
{
settings: {
number_of_shards: 1,
number_of_replicas: 0
}
}'
curl -XPOST "http://localhost:9200/pony_index_tmp/pony/1" -d '
@julien-c
julien-c / global.php
Last active December 16, 2015 16:09
Sentry/Monolog integration in Laravel 4
<?php
if (Config::has('sentry.key')) {
$bufferHandler = new Monolog\Handler\BufferHandler(
new Monolog\Handler\RavenHandler(
new Raven_Client(Config::get('sentry.key')),
Monolog\Logger::WARNING
)
);
@nickdunn
nickdunn / gist:5607392
Last active December 17, 2015 12:09
I run ElasticSearch on the same box as my Apache webserver (one single VPS). I authenticate every request to ElasticSearch.
1. Drop all incoming connections to ElasticSearch on port 9200:
iptables -A INPUT -j DROP -p tcp --destination-port 9200 -i eth0
2. Persist this change on reboot:
iptables-save > /root/my_iptables_config
/sbin/iptables-restore < /root/my_iptables_config
3. Create a directory in your web application, I usually name mine /_es and add an .htaccess file.
@ogrrd
ogrrd / dnsmasq OS X.md
Last active May 9, 2025 23:25
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@aaronksaunders
aaronksaunders / index.js
Last active September 25, 2019 08:59
Appcelerator Titanium Alloy ListView & Facebook Friends Part Two. Using the ListView template in view.xml. New feature coming in Alloy 1.2
/**
* called when an item in the ListView is clicked; we will get the section
* index, and addition event information
*
* @param {Object} _event
*/
function loadMoreBtnClicked(_event) {
alert('not implemented yet');
}
@tegansnyder
tegansnyder / varnish-vcl-config-example-non-www-redirect.txt
Created July 15, 2013 23:49
Varnish VCL configuration for redirecting non-www traffic to www
# added this to
sub vcl_recv {
if (req.http.host == "yourdomain.com") {
set req.http.Location = "http://www.yourdomain.com" + req.url;
error 750 "Permanently moved";
}
}
@refringe
refringe / sendy-server
Last active October 8, 2024 08:14
Nginx configuration file example for Sendy (http://sendy.co/).
server {
listen 80;
listen [::]:80;
server_name domain.com;
autoindex off;
index index.php index.html;
root /srv/www/domain.com/public;