Skip to content

Instantly share code, notes, and snippets.

View sash13's full-sized avatar

Aleksander Ryzhkov sash13

  • Kyiv, Ukraine
  • 18:19 (UTC +03:00)
View GitHub Profile
@sash13
sash13 / infobot.py
Last active May 25, 2018 18:53
join/leave infobot for matrix.
# -*- coding: utf-8 -*-
from matrix_bot_api.matrix_bot_api import MatrixBotAPI
#from matrix_bot_api.mregex_handler import MRegexHandler
from matrix_bot_api.mcommand_handler import MCommandHandler
from mmember_handler import MMemberHandler
import logging
import sys
@sash13
sash13 / clear_chat.sql
Created May 25, 2018 09:28
Remove t2bot chat
DELETE FROM event_edges WHERE room_id = '!PVNuPWbpXKukMcpzUY:t2bot.io';
DELETE FROM room_depth WHERE room_id = '!PVNuPWbpXKukMcpzUY:t2bot.io';
DELETE FROM state_forward_extremities WHERE room_id = '!PVNuPWbpXKukMcpzUY:t2bot.io';
DELETE FROM events WHERE room_id = '!PVNuPWbpXKukMcpzUY:t2bot.io';
DELETE FROM event_json WHERE room_id = '!PVNuPWbpXKukMcpzUY:t2bot.io';
DELETE FROM state_events WHERE room_id = '!PVNuPWbpXKukMcpzUY:t2bot.io';
DELETE FROM current_state_events WHERE room_id = '!PVNuPWbpXKukMcpzUY:t2bot.io';
DELETE FROM room_memberships WHERE room_id = '!PVNuPWbpXKukMcpzUY:t2bot.io';
DELETE FROM feedback WHERE room_id = '!PVNuPWbpXKukMcpzUY:t2bot.io';
DELETE FROM topics WHERE room_id = '!PVNuPWbpXKukMcpzUY:t2bot.io';
@sash13
sash13 / shutdown_room.py
Last active May 18, 2018 21:26
Matrix admin api shutdown_room realization
import urllib2
import json
from builtins import input
# Settings here
HOST = 'https://localhost'
USER = 'admin'
PASS = 'pass'
###############
@sash13
sash13 / sbot.py
Last active May 25, 2018 18:51
s@bot
# -*- coding: windows-1251 -*-
from matrix_bot_api.matrix_bot_api import MatrixBotAPI
from matrix_bot_api.mregex_handler import MRegexHandler
from matrix_bot_api.mcommand_handler import MCommandHandler
import random
import re
from functools import partial
import logging
@sash13
sash13 / gist:b874bc0a645782e4ceebfb9530b387c6
Last active January 28, 2017 17:29
A6 gsm dev board mcu onboard
DIP switch for accesing MCU
1 ON
2 OFF
3 ON
4 OFF
5 OFF
6 OFF
Using tool https://github.com/grigorig/stcgal
[ 119.892927] usb 2-2: new SuperSpeed USB device number 2 using xhci_hcd
[ 119.911673] usb 2-2: New USB device found, idVendor=8086, idProduct=0a80
[ 119.911679] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 119.911682] usb 2-2: Product: Intel RealSense 3D Camera R200
[ 119.911685] usb 2-2: Manufacturer: Intel Corp
[ 119.911687] usb 2-2: SerialNumber: SN_2491013224
[ 119.914721] uvcvideo: Unknown video format 49323159-0000-0010-8000-00aa00389b71
[ 119.914727] uvcvideo: Unknown video format 20493859-0000-0010-8000-00aa00389b71
[ 119.914733] uvcvideo: Found UVC 1.10 device Intel RealSense 3D Camera R200 (8086:0a80)
[ 119.918119] uvcvideo: Unknown video format 2036315a-0000-0010-8000-00aa00389b71
@sash13
sash13 / weather_bot.py
Created September 17, 2016 21:27
wit.ai + openweathermap + telegram bot
# -*- coding: UTF-8 -*-
import sys
from wit import Wit
from pyowm import OWM
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackQueryHandler
import logging
DEFAULT_MAX_STEPS = 5
# Enable logging
@sash13
sash13 / yoba.m
Last active May 22, 2016 16:35 — forked from stdray/yoba.m
m_e = 9.10938356 * 10 .^-31;
E = 10;
alpha = 1;
from = 0;
to = 1000;
v0 = 0.5 .* 299792458;
p = m_e * v0;
w = @(x) x .* exp(-alpha .* x);
N2 = @(x) integral(w, from, to) ;
$python2 btle.py FF:FF:F0:00:AB:D6
Connecting to: FF:FF:F0:00:AB:D6, address type: public
Service <uuid=Generic Access handleStart=1 handleEnd=5> :
Characteristic <Device Name>, hnd=0x2, supports NOTIFY READ
-> 'MLE-15 '
Characteristic <Appearance>, hnd=0x4, supports READ
-> '\x00\x00'
Service <uuid=Battery Service handleStart=6 handleEnd=8> :
Characteristic <Battery Level>, hnd=0x7, supports NOTIFY READ
-> 'c'
@sash13
sash13 / Servo8bit.cpp
Created February 15, 2016 17:43
Canbot
/*
Servo8Bit.cpp - Interrupt driven Servo library for the Attiny45 and Attiny85 that uses an 8 bit timer.
Version 0.6
Copyright (c) 2011 Ilya Brutman. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.