Skip to content

Instantly share code, notes, and snippets.

@acidChrist
acidChrist / new_task.py
Created December 7, 2016 19:26 — forked from quiver/new_task.py
rabbitmq : dead letter exchange example with python/pika
#!/usr/bin/env python
# http://www.rabbitmq.com/tutorials/tutorial-two-python.html
import pika
import sys
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
message = ' '.join(sys.argv[1:]) or "Hello World!"
@acidChrist
acidChrist / helloworld-win32-service.py
Last active April 28, 2017 05:38 — forked from drmalex07/helloworld-win32-service.py
An example Windows service implemented with pywin32 wrappers. #python #windows-service #pywin32
import win32serviceutil
import win32service
import win32event
import servicemanager
import socket
import time
import logging
logging.basicConfig(
filename = 'c:\\Temp\\hello-service.log',
@acidChrist
acidChrist / gist:11cd088a17abb39afc25
Last active August 29, 2015 14:05 — forked from axe312ger/gist:7784737
err: /Stage[main]//Apache::Vhost[halastica.k1.ff]/File[/vagrant/web]/group: change from dialout to root failed: Failed to set group to '0': Operation not permitted - /vagrant/web
sudo chgrp 0 [shared folder on host]
ex:
sudo chgrp 0 web
# How to use
* Download the log4j.properties file
* Add it to your logstash jar file: jar -uf logstash-1.0.10.jar log4j.properties
class java {
class { 'apt': }
# Add PPA
apt::ppa { 'ppa:webupd8team/java': } ->
# Prepare response file
file { "/tmp/oracle-java7-installer.preseed":
source => 'puppet:///modules/java/java.response',
mode => 600,
backup => false,
} ->
#create a test index with shingle mapping
curl -XPUT localhost:9200/test -d '{
"settings":{
"index":{
"analysis":{
"analyzer":{
"analyzer_shingle":{
"tokenizer":"standard",
"filter":["standard", "lowercase", "filter_stop", "filter_shingle"]
}
/**
* $q query term
* 'field' => 'suggest'> Suggest is the fieldname used during indexing
* see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html
*/
$elasticaClient = new \Elastica\Client();
$elasticaIndex = $elasticaClient->getIndex('myindex');
$search = new \Elastica\Search($elasticaClient);
$suggest = new \Elastica\Suggest\Term();
$suggest->addTerm('suggest', ['text' => $q, 'completion' => ['field' => 'suggest']]);

Awesome PHP

A curated list of amazingly awesome PHP libraries, resources and shiny things.

Composer

Composer Related

# How to use
* Download the log4j.properties file
* Add it to your logstash jar file: jar -uf logstash-1.0.10.jar log4j.properties
W HTML:
<input type="hidden" id="photoToDelete" />
Galleria.run('#gallery',{
extend: function() {
var gallery = this;
$('#remove_photo_link').click(function(){