This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from tornado.ioloop import IOLoop | |
| from tornado.gen import coroutine | |
| from tornado.httpclient import AsyncHTTPClient, HTTPRequest | |
| from tornado.queues import Queue | |
| try: | |
| from tqdm import tqdm | |
| except ImportError: | |
| tqdm = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var agent = navigator.userAgent.toLowerCase(); | |
| if (/iphone|ipad|ipod/i.test(agent)) { | |
| window.location = 'https://{appstore_link}'; | |
| } | |
| else if (/android/i.test(agent)) { | |
| window.location = 'https://{gplay_link}'; | |
| } | |
| else { | |
| window.location = 'http://{web_version}'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl localhost:9200/*/_mapping | jq -S 'map_values(.mappings|map_values(.properties|try map_values(.type)))' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -x | |
| set -e | |
| # allows `docker build ...` to use images cache | |
| # could be installed with: pip install restore_commit_times | |
| #restore_commit_times . | |
| DOCKERFILE_LOCATION="$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - name: upgrade elasticsearch | |
| hosts: elastic | |
| serial: 1 | |
| tasks: | |
| - name: stop elasticsearch | |
| service: name=elasticsearch state=stopped | |
| - name: remove elasticsearch plugins | |
| command: /usr/share/elasticsearch/bin/elasticsearch-plugin remove x-pack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # see https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html | |
| docker run -d --restart=always \ | |
| --name elasticsearch \ | |
| -p 127.0.0.1:9200:9200 \ | |
| -v /srv/elasticsearch:/usr/share/elasticsearch/data \ | |
| -e ES_JAVA_OPTS="-Xms1g -Xmx1g" \ | |
| -e bootstrap.memory_lock=true \ | |
| -e cluster.name=edadeal \ | |
| -e xpack.security.enabled=false \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @namespace url(http://www.w3.org/1999/xhtml); | |
| @-moz-document domain("samlib.ru") { | |
| * { | |
| background: black; | |
| color: #6af; | |
| } | |
| body { | |
| width: 20cm; | |
| margin: auto; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "image/jpeg" | |
| "log" | |
| "os" | |
| "path/filepath" | |
| "sync" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import pygame | |
| def show(a): | |
| global screen | |
| if 'screen' not in globals(): | |
| screen = pygame.display.set_mode((0, 0), pygame.RESIZABLE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # http://stackoverflow.com/a/39301723/2649222 | |
| def format_money(f, delimiter=',', frac_digits=2): | |
| ''' | |
| >>> format_money(1.7777) | |
| '1.78' | |
| >>> format_money(-1.7777) | |
| '-1.78' | |
| >>> format_money(12.7777) | |
| '12.78' | |
| >>> format_money(-12.7777) |