Skip to content

Instantly share code, notes, and snippets.

View breyten's full-sized avatar

Breyten Ernsting breyten

View GitHub Profile
@fdebijl
fdebijl / Instructions.md
Last active December 28, 2018 15:35
Blocked Tweet Hider
@SuneKjaergaard
SuneKjaergaard / check_uwsgi.sh
Last active January 12, 2024 04:01
Small shell script to restart the uWSGI application when https://github.com/unbit/uwsgi/issues/1369 happens. Based on uWSGI server run by upstart
#!/bin/bash
line=$(tail -1 /var/log/myapp/myapp.uwsgi.log)
substr='uWSGI listen queue of socket'
if test "${line#*$substr}" != "$line"
then
#We're using upstart, could be easily adapted to fx systemd
# Adding a log statement to keep track of when this happens. Remember to create the monitor dir
/sbin/initctl restart myapp > /var/log/myapp/monitor/uwsgi-monitor.log 2>&1
echo "$(date) restarted myapp due to listen queue error" >> /var/log/myapp/monitor/uwsgi-monitor.log
@craigdmckenna
craigdmckenna / sqlalchemy_mysql_binary_uuid.py
Last active January 15, 2023 21:22
SQLAlchemy, MySQL 16 bit UUID, Custom Data Type
import UUID
from sqlalchemy.dialects.mysql import BINARY
from sqlalchemy.types import TypeDecorator
class BinaryUUID(TypeDecorator):
'''Optimize UUID keys. Store as 16 bit binary, retrieve as uuid.
inspired by:
http://mysqlserverteam.com/storing-uuid-values-in-mysql-tables/
@marijer
marijer / README.md
Last active July 9, 2021 20:45
Module 4 - Municipalities of the Netherlands
@PSJoshi
PSJoshi / elasticsearch-tunning
Last active August 29, 2015 14:17
Elasticsearch tunning
vi /etc/elasticsearch/elasticsearch.yml
#Add the following line somewhere in the file, to disable dynamic scripts:
script.disable_dynamic: true
bootstrap.mlockall: true
http.cors.allow-origin: "/.*/"
http.cors.enabled: true
#Add to /etc/sysctl.conf
fs.file-max = 65536
anonymous
anonymous / config.json
Created December 2, 2014 14:21
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#0097EB, 0%)",
"@brand-success": "#5cb85c",
anonymous
anonymous / config.json
Created December 2, 2014 14:13
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(0097EB, 0%)",
"@brand-success": "#5cb85c",
@greenwoodma
greenwoodma / mp_twitter_accounts.csv
Last active September 10, 2015 10:30 — forked from iaincollins/mp_twitter_accounts.csv
A hand corrected and updated list of MP twitter accounts and DBpedia pages, produced as part of a Nesta funded project.
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"full_name";"party";"official_post";"constituency";"twitter_handle";"twitter_user_id";"uri";"last_updated";"notes"
"Ms Diane Abbott MP";"Labour";;"Hackney North and Stoke Newington";"https://twitter.com/HackneyAbbott";153810216;"http://dbpedia.org/resource/Diane_Abbott";"2014-10-18T10:04:00+01:00";
"Debbie Abrahams MP";"Labour";;"Oldham East and Saddleworth";"https://twitter.com/Debbie_abrahams";225857392;"http://dbpedia.org/resource/Debbie_Abrahams";"2014-10-18T10:04:00+01:00";
"Nigel Adams MP";"Conservative";;"Selby and Ainsty";"TWITTER_UNKNOWN";-1;"http://dbpedia.org/resource/Nigel_Adams";"2014-10-18T10:04:00+01:00";
"Adam Afriyie MP";"Conservative";;"Windsor";"https://twitter.com/AdamAfriyie";22031058;"http://dbpedia.org/resource/Adam_Afriyie";"2014-10-18T10:04:00+01:00";
"Rt Hon Bob Ainsworth MP";"Labour";;"Coventry North East";"TWITTER_UNKNOWN";-1;"http://dbpedia.org/resource/Bob_Ainsworth";"2014-10-18T10:04:00+01:00";
"Peter Aldous MP";"Conservative";;"Waveney";"https://twitter.com/peter_aldous";255998
@drorata
drorata / gist:146ce50807d16fd4a6aa
Last active June 3, 2024 06:00
Minimal Working example of Elasticsearch scrolling using Python client
# Initialize the scroll
page = es.search(
index = 'yourIndex',
doc_type = 'yourType',
scroll = '2m',
search_type = 'scan',
size = 1000,
body = {
# Your query's body
})
@dominicsayers
dominicsayers / elasticsearch.md
Last active August 12, 2024 08:14
Configuring ElasticSearch to use less memory

What I actually did

/etc/security/limits.conf

elasticsearch hard memlock 100000

/etc/default/elasticsearch