Skip to content

Instantly share code, notes, and snippets.

View podolinek's full-sized avatar

Ondrej Podolinský podolinek

View GitHub Profile
# [Mon Jan 16 11:23:14 2012] Protocol: http, Server: 192.168.5.10:9200
curl -XPUT 'http://127.0.0.1:9200/users/?pretty=1' -d '
{
"mappings" : {
"info" : {
"_all" : {
"type" : "string",
"analyzer" : "uax_url_email"
},
"properties" : {
@podolinek
podolinek / gist:3900311
Created October 16, 2012 16:16 — forked from pulkitsinghal/gist:1932711
Ramping Up on ElasticSearch Query DSL
// 1) Lets start with the simplest query that you can run in
// the head plugin for ElasticSearch located at the url:
// http://localhost:9200/_plugin/head/
{
"query": {
"match_all": {}
}
}
// 2) Before jumping into forming queries with the ES Query DSL
<?php
require 'nette.phar';
//Tracy\Debugger::enable();
$dns = "mysql:host=localhost;dbname=database";
$user = "user";
$password = "*****";
@milo
milo / post-merge
Created July 23, 2015 11:48
Git hook for purging cache
#!/bin/sh
# Save as .git/hooks/post-merge
# Set execute bit like: chmod ug+x .git/hooks/post-merge
purgePath="temp/cache"
echo
echo -n "HOOK [Purge cache]: "
if [ -d "$purgePath" ]; then
@fprochazka
fprochazka / sqlSelect.php
Created November 30, 2015 22:16 — forked from xbukovsk-zz/sqlSelect.php
sql select
<? php
public static function getAllIndicatorValuesOverview($userId = null) {
$surveys = self::getConnection()->query(
'SELECT surveys.surveyId,surveys.year,user.organizationName
FROM surveys
LEFT JOIN user ON surveys.userId=user.userId'
)->fetchAll();
foreach($surveys as &$survey) {
error_log syslog:server=unix:/var/log/nginx.sock;
http {
log_format verbose '$remote_addr - $remote_user $host "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
map $status $loggable {
~^[2] 0;
default 1;
}
@fprochazka
fprochazka / .1 readme.md
Last active October 27, 2018 16:15
.git/hooks/post-checkout

post checkout hook na mazání cache

  • post-checkout.sh uložit jako .git/hooks/post-checkout
  • .invalidate-opcache.php jako www/.invalidate-opcache.php (POZOR! - tenhle soubor buďto na produkci nenahrávat, nebo zablokovat přístup!)
@samdark
samdark / github-post-receive.php
Last active October 11, 2019 10:05
Simple GitHub post-receive PHP hook
<?php
function cidr_match($ip, $ranges)
{
$ranges = (array)$ranges;
foreach($ranges as $range) {
list($subnet, $mask) = explode('/', $range);
if((ip2long($ip) & ~((1 << (32 - $mask)) - 1)) == ip2long($subnet)) {
return true;
}
}
@adityamukho
adityamukho / User.js
Last active November 11, 2021 21:41
Passport authentication for Sails.js 0.9.x
/**
* api/models/User.js
*
* The user model contains the instance method for validating the password.
*/
var bcrypt = require('bcrypt');
function hashPassword(values, next) {
bcrypt.hash(values.password, 10, function(err, hash) {
@mystix
mystix / install-elasticsearch-debian
Last active March 19, 2023 15:14 — forked from karussell/install-elasticsearch-debian
Install ElasticSearch on Debian
VERSION=0.20.6
sudo apt-get update
sudo apt-get install openjdk-6-jdk
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$VERSION.deb
sudo dpkg -i elasticsearch-$VERSION.deb
# be sure you add "action.disable_delete_all_indices" : true to the config!!