Skip to content

Instantly share code, notes, and snippets.

View erdem's full-sized avatar

Erdem Ozkol erdem

View GitHub Profile
@atouchard
atouchard / varnish-install.sh
Last active September 29, 2021 16:16
Install Varnish on MacOSX via Homebrew
#!/bin/sh
#
# Install Varnish via Homebrew
#
# You need to add /usr/local/sbin in your PATH
# vcl files are in /usr/local/etc/varnish
#
# Usage :
@philfreo
philfreo / elb.py
Created September 26, 2013 18:19
Python script to remove/add an EC2 instance into an AWS ELB. Helpful during deployments. (Using Flask / Flask-Script but easily modifiable)
#!/usr/bin/env python
import time
import boto
import boto.ec2.elb
import boto.utils
from flask.ext.script import Manager
from closeio.main import setup_app
@duydo
duydo / gist:9587121
Last active March 21, 2018 12:15
Elasticsearch mutiple language mapping
{
"analysis": {
"filter": {
"ar_stop_filter": {
"type": "stop",
"stopwords": ["_arabic_"]
},
"bg_stop_filter": {
"type": "stop",
"stopwords": ["_bulgarian_"]
@st4lk
st4lk / mandrill_email.py
Last active August 2, 2021 05:31
Python: send emails by mandrill. Django and standalone example
"""
Example of mandrill service in python (http://mandrill.com/)
Description of usage in python:
Russian: http://www.lexev.org/2014/send-email-django-project-mandrill-service/
English: http://www.lexev.org/en/2014/send-email-django-project-mandrill-service/
"""
# ======
# Django
@StephanHoyer
StephanHoyer / elasticsearch-example.js
Created September 29, 2015 10:56
Simple example how to use elastic search with node.js
'use strict';
var elasticsearch = require('elasticsearch');
var Promise = require('bluebird');
var log = console.log.bind(console);
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
@erdem
erdem / countries.json
Last active May 30, 2024 22:37
Country list as JSON format. fields: name, coordinates, timezones, country code and capital resource: https://github.com/mledoze/countries
[
{
"timezones": [
"America/Aruba"
],
"latlng": [
12.5,
-69.96666666
],
"name": "Aruba",
@MikeyBurkman
MikeyBurkman / esclient.js
Last active June 29, 2017 14:31
ElasticSearch Example
#! /usr/bin/env cecil
// Usage:
// ./esclient.js http://your-elasticsearch-host.com
var elasticsearch = include('elasticsearch', '^11.0.0');
var moment = include('moment', '^2.13.0');
var R = include('ramda', '^0.21.0');
var Promise = include('bluebird', '^3.4.0');
@speedplane
speedplane / celery_app.py
Created October 25, 2017 02:02
Celery Autoscaler Based on Memory and System Load
import multiprocessing
import re
from celery import Celery
from celery.worker.autoscale import Autoscaler as CeleryAutoscaler
class DAAutoscaler(CeleryAutoscaler):
# Try to keep the load above this point.
LOAD_MIN = .8
# Try to keep the load below this.
LOAD_MAX = 1.1
@codl
codl / brotli.vcl
Last active October 7, 2021 00:55
sub vcl_recv {
if(req.http.Accept-Encoding ~ "br") {
set req.http.X-brotli = "true";
}
}
sub vcl_hash {
if(req.http.X-brotli == "true") {
hash_data("br");
}
@merit-mthompson
merit-mthompson / README.md
Last active November 6, 2020 22:53
Django Multi-DB ForeignKey

Multi-DB Django example.

Doing this we're able to load our example model into the admin, view it and all related bits and even save without issue. There are some issues when using foreign keys from separate databases in list views in the admin.

Most of this is documented at https://docs.djangoproject.com/en/3.1/topics/db/multi-db/. We've just modified it a bit so things live in settings.

Names for things might seem weird because we've changed them to protect the innocent...