Skip to content

Instantly share code, notes, and snippets.

View podolinek's full-sized avatar

Ondrej Podolinský podolinek

View GitHub Profile
@podolinek
podolinek / drive-format-ubuntu.md
Created June 3, 2019 11:04 — forked from keithmorris/drive-format-ubuntu.md
Partition, format, and mount a drive on Ubuntu
FROM php:7.1-apache
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN=true
RUN apt-get update -q \
&& apt-get install unzip git libicu-dev curl libcurl4-gnutls-dev libmcrypt-dev -y --no-install-recommends
RUN docker-php-ext-install intl sockets curl pdo_mysql \
# xdebug is installed, but not enabled
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;
}
@podolinek
podolinek / sqlSelect.php
Created October 27, 2018 16:11 — forked from fprochazka/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) {
@podolinek
podolinek / ApacheHTTPSConfig.md
Last active April 26, 2018 11:26 — forked from nrollr/ApacheHTTPSConfig.md
Enable SSL in Apache for 'localhost' (OSX, El Capitan)

Enable SSL in Apache installed by Homebrew

The following will guide you through the process of enabling SSL on a Apache webserver

  • The instructions have been verified with OSX High Sierra (10.13) running Apache 2.4.16
  • The instructions assume you already have a basic Apache configuration installed via homebrew by "brew install httpd"

Apache SSL Configuration

Create a directory within /usr/local/etc/httpd using Terminal.app: sudo mkdir /usr/local/etc/httpd/ssl
Next, generate two host keys:

sudo apt-get update
sudo apt-get install openjdk-6-jdk
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.8.deb
sudo dpkg -i elasticsearch-1.3.8.deb
# be sure you add "action.disable_delete_all_indices : true" to the config!!
# start script
sudo /etc/init.d/elasticsearch restart
# ========================================
# Testing multiple analyzers per field
# ========================================
# Setup
curl -s -X DELETE 'http://localhost:9200/news_test/'
# Create index with settings and mapping
curl -s -X PUT 'http://localhost:9200/news_test' -d '
{
# [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