Skip to content

Instantly share code, notes, and snippets.

Sergey Shepelev temoto

Block or report user

Report or block temoto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@temoto
temoto / guide.md
Created Aug 2, 2019
Atom + Go with modules config for 2019-08
View guide.md

How to setup Atom for Go development with 1.11+ modules support

For projects outside GOPATH.

  • go get github.com/saibing/bingo why: https://github.com/ckaznocha/ide-go/issues/42 Run which bingo and have full path in clipboard.
  • (Atom) install package go-plus for format/build/test-on-save It's great, but go-plus autocomplete doesn't work with modules. Settings, packages, go-plus, Autocomplete, set Scope blacklist *
  • (Atom) install package ide-go
@temoto
temoto / mqtt-color-temp-control.py
Last active Oct 22, 2018
Automate lights color temperature via MQTT enabled dimmer (like Sonoff). Temporary location, will be moved to full repository.
View mqtt-color-temp-control.py
#!/usr/bin/env python2
import os, sys, time
import astral, datetime
import paho.mqtt.client
# EDIT HERE TO CONFIGURE + run with env `mqtt_broker=addr:port mqtt_topic=cmnd/house/ct script.py`
config = 'midnight scale_down sunrise 0% noon scale_up sunset 100%'
lat, lng = (58.0, 56.316) # Perm
@temoto
temoto / parse.y.patch
Last active Dec 6, 2017
sqlite fail build with ENABLE_UPDATE_DELETE_LIMIT flag when sqlite3.c was configured without it, e.g. amalgamation from sqlite website
View parse.y.patch
--- a/src/parse.y 2017-12-06 05:26:36.000000000 +0300
+++ b/src/parse.y 2017-12-06 05:22:53.000000000 +0300
@@ -758,6 +758,13 @@
}
%endif
%ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
+%include {
+#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
+ #error To build SQLite with -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT you have to run ./configure with --enable-update-limit flag. \
+Most likely you are building amalgamation from http://www.sqlite.org/download.html which is not compatible with this feature. \
View keybase.md

Keybase proof

I hereby claim:

  • I am temoto on github.
  • I am temoto (https://keybase.io/temoto) on keybase.
  • I have a public key whose fingerprint is 1A40 5559 7839 D277 88D0 0647 F6C3 E55C 75EA CF08

To claim this, I am signing this object:

View phoneword.py
#!/usr/bin/env python3
import argparse
import bisect
import itertools
import sys
# % cat wordlist
# a b c
# pig bird
# rig sig
@temoto
temoto / mysql-loop
Last active Jul 31, 2016
Tool for DBA / Operations. Repeats command against chunks of large MySQL table, delay between runs adapts to minimise load (judged by mean execution time of N last runs).
View mysql-loop
#!/usr/bin/env python3
import argparse
import itertools
import subprocess
import sys
import time
pk_alphabet_level1 = '0123456789abcdefghijklmnopqrstuvwxyz'.replace('.', '')
pk_alphabet_level2 = '0.......8.......g.......o.....u.....'.replace('.', '')
@temoto
temoto / aws-iam-ssh-keys.py
Last active Mar 30, 2016
Sync (overwrite) IAM public SSH keys to my servers at regular intervals. Update keys immediately on change is possible but make it yourself. CloudTrail-CloudWatch-{write this poll service}.
View aws-iam-ssh-keys.py
#!/usr/bin/env python3
import botocore.session
import distutils.spawn
import codecs
import grp, pwd
import os
import shutil
import subprocess
import sys
from datetime import datetime
@temoto
temoto / mysql-convert-myisam-to-innodb.sh
Last active Mar 15, 2016
MySQL administration: convert MyISAM tables to InnoDB
View mysql-convert-myisam-to-innodb.sh
#!/bin/bash
sql_list="select table_schema, table_name from information_schema.tables where lower(engine) = 'myisam' and table_schema not in ('mysql', 'information_schema', 'performance_schema') order by data_length;"
mysql --batch --silent -e "$sql_list" |while read -r d t; do
printf "\n---\n$d.$t "
mysql --batch --silent -e "select (data_length+index_length)/1e6 from information_schema.tables where table_schema='$d' and table_name='$t';"
time mysql --batch --silent -e "alter table $d.$t engine='innodb';"
done
@temoto
temoto / megafon-account.bash
Last active Mar 3, 2016
Экспорт балансов Мегафона. Работает с TLSv1 уральского региона (информация актуальна 2016-03-03).
View megafon-account.bash
#!/bin/bash
# https://gist.github.com/temoto/efc4cf36fe388b41715b
set -e
umask 0077
cookie_path='/tmp/megafon-jar'
output_path=~/megafon-account.csv
username='EDIT'
password='EDIT'
url_base='https://EDIT'
url_path_init='/sc_cp_apps/login'
@temoto
temoto / asset-clean
Created Feb 18, 2016
[website deploy] Find references to missing assets files. Helps to prevent 404 and 500 (pagespeed beacon) errors.
View asset-clean
#!/bin/bash
set -e
find . -print0 |fgrep -v --null-data --null '/.hg/' >tmp-asset-clean-all
egrep -hIor "/\w+/\w+\.(gif|jpg|jpeg|png|eot|svg|ttf|woff|webm|webp)" |sort -u >tmp-asset-clean-refs
for f in $(cat tmp-asset-clean-refs); do
dir=${f%%/*}
name=${f##*/}
if ! egrep --max-count=1 --null-data -q $f tmp-asset-clean-all; then
echo -e "\n\n$f not found. References:\n $(egrep -Inr $f)\n\n"
fi
You can’t perform that action at this time.