Skip to content

Instantly share code, notes, and snippets.

@david206
david206 / fetch929.py
Last active February 29, 2016 04:35
929 project (www.929.org.il) has great soundcloud page with daily updates. But - it doesn't have rss feed, or Podcast option. In my daily commute I don't have internet connection. So with the following script + Cron job that runs it daily + foldersync to my Android phone - I automaticly download the new sound files and copy them to my phone.
#!/home/shimon/anaconda2/bin/python
# -*- coding: utf-8 -*-
from lxml import html
import requests
import youtube_dl
url = 'https://soundcloud.com/929-bible/sets/'
base_url = 'https://soundcloud.com'
@david206
david206 / books.py
Created May 18, 2017 22:48
translate the bible books names from English to Hebrew
{
'Genesis': 'בראשית',
'Exodus': 'שמות',
'Leviticus': 'ויקרא',
'Numbers': 'במדבר',
'Deuteronomy': 'דברים',
'Joshua': 'יהושע',
'Judges': 'שופטים',
'I Samuel': 'שמואל א',
'II Samuel': 'שמואל ב',
@david206
david206 / buckets_with_same_name.sh
Created September 4, 2017 12:53
Failed avg_bucket aggregation when buckets_path include nested bucket with same name as other bucket.
curl -XDELETE 'localhost:9200/docs?pretty'
curl -XPUT 'localhost:9200/docs?pretty' -H 'Content-Type: application/json' -d'
{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 1
}
@david206
david206 / failed_avg_bucket_aggregation.sh
Created September 4, 2017 12:54
Failed avg_bucket aggregation when buckets_path include nested bucket with same name as other bucket. it works with terms aggregation instead of date_histogram, and it works when renaming one of the identically named buckets
curl -XDELETE 'localhost:9200/docs?pretty'
curl -XPUT 'localhost:9200/docs?pretty' -H 'Content-Type: application/json' -d'
{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 1
}
@david206
david206 / tracks.txt
Created November 2, 2017 18:34
Medium Engineering growth: tracks.
Mobile
Works effectively within established iOS or Android architectures, following current best practices
signals:
Delivers features requiring simple local modifications
Adds simple actions that call server endpoints
Reuses existing components appropriately
examples:
Added existing button to a different iOS surface
Add follow button for publications on Android
Fetched and displayed a new stream, using existing stream item styles
#!/bin/bash
REPO_DIR="/path/to/your/repositories"
configure_pre_commit() {
repo_path="$1"
cd "$repo_path" || return 1
if ! command -v pre-commit &> /dev/null; then
echo "pre-commit is not installed. Installing..."