Skip to content

Instantly share code, notes, and snippets.

View etataurov's full-sized avatar

Eugene Tataurov etataurov

  • Amsterdam, The Netherlands
View GitHub Profile
var SpotifyWebApi = require('spotify-web-api-node');
var YandexMusicApi = require('yandex-music-api');
var yandexApi = new YandexMusicApi();
var spotifyApi = new SpotifyWebApi({
clientId: "CLIENTID",
clientSecret: "CLIENTSECRET"
});
var getMatchingSong = function(track) {
var options = { type: "track" };
var title = track.track.artists[0].name + ' ' + track.track.name;
package main
import (
"context"
"fmt"
"github.com/google/go-github/github"
)
func main() {
if answer["response_code"] == 1 : # if we got a regular result
pos = answer["positives"] # number of checks that consider this part as a virus
tot = answer["total"] # total number of checks
if answer["positives"] >1 : # if there is any positive
result = True # set the result to malware
resultStringLong += "# "+ filename+":"+ str(pos) + "/" + str(tot) + " " # result 'en detail'
else :
resultStringLong += "# clean:"+filename+" " # no result, most likely that means: not a virus
if answer["response_code"] == 1 : # if we got a regular result
pos = answer["positives"] # number of checks that consider this part as a virus
tot = answer["total"] # total number of checks
if answer["positives"] >1 : # if there is any positive
result = True # set the result to malware
resultStringLong += "# "+ filename+":"+ str(pos) + "/" + str(tot) + " " # result 'en detail'
else :
resultStringLong += "# clean:"+filename+" " # no result, most likely that means: not a virus
import sys
from PIL import Image
filename = sys.argv[1]
my_new_image = Image.new('RGB', (510, 311), (255,255,255,0))
old_image = Image.open(filename)
old_size = old_image.size
aspect = old_size[0] / float(old_size[1])
new_width = int(aspect*311)
paste = (510 - new_width)/2
@etataurov
etataurov / __init__.py
Created February 22, 2015 15:48
arequests
from arequests.api import *
@etataurov
etataurov / benchmark.py
Created July 21, 2014 06:13
txredisapi little benchmark
import time
from twisted.internet import defer
from twisted.internet import reactor
import txredisapi as redis
HOST = 'localhost'
PORT = 6379
N = 1000
@etataurov
etataurov / fabtest.py
Last active August 29, 2015 14:03
BaseTestCase for testing fabric tasks in docker containers
# encoding: utf-8
from __future__ import print_function
import docker
import unittest
from fabric.api import env, run, execute
class DockerTest(unittest.TestCase):
def setUp(self):
self.client = docker.Client(**self.get_client_spec())
-module(facebook).
-export([square/1, print_square/1]).
square(N)->square(1, N).
square(Start, 1)->[[Start]];
square(Start, 2)->[[Start, Start+1], [Start+3, Start+2]];
square(Start, N)->
TopRight = Start+N-1,
[lists:seq(Start, TopRight)]++
extend(square(TopRight+3*N-3, N-2), TopRight+3*N-4, TopRight+1, [])++
@etataurov
etataurov / main.py
Created September 24, 2013 08:44
Проверятор состояния посылки, отправленной ShopFans Express. Каждые N минут ходит по указанной ссылке, в случае нового события шлет письмо
#!/usr/bin/env python3
from datetime import timedelta
import time
import json
import logging
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import tornado.ioloop