Skip to content

Instantly share code, notes, and snippets.

View automation-stack's full-sized avatar

Aleksandr Komlev automation-stack

  • YCLIENTS LLC
  • Russia
View GitHub Profile
You will be supplied with two data files in CSV format .
The first file contains statistics about various dinosaurs. The second file contains additional data.
Given the following formula, `speed = ((STRIDE_LENGTH / LEG_LENGTH) - 1) * SQRT(LEG_LENGTH * g)`
Where g = 9.8 m/s^2 (gravitational constant)
Write a program to read in the data files from disk, it must then print the names of only the bipedal dinosaurs from fastest to slowest.
Do not print any other information.
$ cat dataset1.csv
NAME,LEG_LENGTH,DIET
import aiohttp
import uvloop
from time import time
from asyncio import get_event_loop, ensure_future, set_event_loop
# Example for asynchronous library `aiohttp` (using only main thread)
set_event_loop(uvloop.new_event_loop())
@automation-stack
automation-stack / beat_the_bastard.py
Last active March 28, 2017 13:44
How to properly configure Sophos Antivirus?
import psutil
from time import sleep
bastards = 0
try:
while 1:
for proc in psutil.process_iter():
try:
pinfo = proc.as_dict(attrs=['pid', 'name'])
@automation-stack
automation-stack / npm-f3-install.sh
Created July 16, 2016 00:31 — forked from SuperPaintman/npm-f3-install.sh
NPM install for low RAM machins. And "npm install ... killed" problem
#!/bin/bash
#
# Author: SuperPaintman <SuperPaintmanDeveloper@gmail.com>
#
###
# Constants
###
RETVAL=0
@automation-stack
automation-stack / 600k_concurrent_connections.md
Created February 23, 2016 16:50
How to make 600k concurrent connections on a single PC

An IP can only issue most 65536 connections to a server, since socket port is unsigned short. But we can bypass this limit. On Linux, it’s quite easy to set up virtual network interface:

for i in `seq 200 230`; do sudo ifconfig eth0:$i 192.168.1.$i up ; done

Then your computer have many IPs, from 192.168.1.200 to 192.168.1.230. The server bind to 0.0.0.0@port, the client can connect 192.168.1.200@port, or 192.168.1.201@port, etc. Per IP can have about 60K concurrent connections. Then the client can issue as many concurrent connections as it needed.

@automation-stack
automation-stack / electron-restart.md
Last active February 23, 2016 16:56
Restart electron application

Step 1 :

var child = require('child_process').exec;
var path = require('path');

var applicationPath, endIndex = process.resourcesPath.indexOf('/Contents');
applicationPath = process.resourcesPath.substring(0, endIndex); // Entire app path. param 1
var appToKill = 'Electron'; // assuming appName for testing purpose, param 2