Skip to content

Instantly share code, notes, and snippets.

View sergiks's full-sized avatar

Sergei Sokolov sergiks

  • Russia | Europe | Thailand
View GitHub Profile
@sergiks
sergiks / browser.py
Created October 17, 2018 06:08
Python QT web browser webview component example
# src: https://python.su/forum/topic/33143/?page=1#post-181129
import sys
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWebEngineWidgets import QWebEngineView
class Browser(QWebEngineView):
def __init__(self):
super().__init__()
@sergiks
sergiks / Scale_video_overlay.js
Created August 7, 2018 21:11
Scale video to fit window and an overlay to fit video
/**
* algorithm to center fit overlay image
* over an arbitrary sized video or image
*/
function fit(video_width, video_height) {
const video_aspect = video_width / video_height;
// Overlay image - png with transparency
@sergiks
sergiks / TelegramClient.js
Created August 5, 2018 17:49
Google Apps Script Telegram bot parts
function TelegramClient(token) {
var _token = token;
this.getURL = function() {
return "https://api.telegram.org/bot" + _token;
}
this.getResponse = function( method, data) {
var response = UrlFetchApp
.fetch(
@sergiks
sergiks / readme.md
Last active August 7, 2023 09:53
VK Group Widget starter page

Widgeteer

HTML + JavaScript для прототипирования виджета Сообщества в ВКонтакте.

ВНИМАНИЕ – код устарел

Теперь ВКонтакте изменили схему: требуется получать токен через VK Mini App, а не как раньше через xd_connection.

Пример получения токена для редактирования виджета сообщества ВКонтакте: https://github.com/Deserter-io/vk-group-widget/blob/gh-pages/index.html и его работающее демо мини-апп: https://vk.com/app7463429


@sergiks
sergiks / Votes.ipynb
Created March 23, 2018 16:47
Обновлённая версия ноутбука исследования результатов голосования КСИ
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergiks
sergiks / Votes.ipynb
Created March 18, 2018 09:43
Анализ голосования подконкурса рекламных материалов КСИ
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergiks
sergiks / Deserter vs. TargetHunter.ipynb
Last active March 15, 2018 14:04
Deserter vs. TargetHunter
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergiks
sergiks / pandas filtering playground.ipynb
Created February 21, 2018 15:14
Filering rows with similar values within pandas DataSet
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergiks
sergiks / reset_file_associations.sh
Created February 13, 2018 20:52
OS X reset of file associations with apps used to open them
# Source: https://superuser.com/questions/640730/mac-os-x-file-associations-keep-changing-though-reverting-it-manually
# Delete LaunchServices prefs:
rm ~/Library/Preferences/com.apple.LaunchServices.plist
# Rebuild the Launch Services database with
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -domain local -domain system -domain user
@sergiks
sergiks / naiveBayes.py
Created October 25, 2017 19:56
Naive Bayes attempt to classify boolean data
"""
Feature is 512 1-s or 0-s, label is 1 or 0
Data represents some bio research on components added to a mixture,
all are independant one from another.
Outcome is passing some threshold for a further research.
"""
import numpy as np
from sklearn.naive_bayes import GaussianNB