Skip to content

Instantly share code, notes, and snippets.

View gshimansky's full-sized avatar

Gregory Shimansky gshimansky

  • Intel Corporation
View GitHub Profile
@gshimansky
gshimansky / gen_h2o_data.py
Last active October 9, 2020 19:45
Generate data files for h2o benchmark https://github.com/h2oai/db-benchmark
import subprocess
import pandas as pd
columns = ["task", "data", "nrow" , "k", "na", "sort", "active"]
dtypes = {x: str for x in columns}
data = pd.read_csv("_control/data.csv", names=columns, dtype=dtypes)
for index, row in data.iterrows():
if row["active"] != "1":
continue
@gshimansky
gshimansky / pstats_parser.py
Last active October 9, 2020 19:46
Parse python cProfile pstat files and output sorted data
import os
import time
import pstats
import argparse
import pandas as pd
csv_columns = [
"ncalls",
"ncalls_percent",
"primitive_calls",
@gshimansky
gshimansky / convert_to_usd.py
Last active February 24, 2020 02:33
Convert income and taxes from roubles to USD using official conversion rate table
#!/usr/bin/env python3
import pandas as pd
import argparse
def main():
# Parse command line
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
description="""
Convert RUR income and taxes, sums them and substracts.
import sys
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0
devices = {
'nintendo': 36,
'samsung': 31,
'ps4': 32,
@gshimansky
gshimansky / irc.service
Created April 5, 2019 18:46
Systemd service file to start screen with irssi upon system boot. Use systemctl daemon-reload; systemctl enable irc.service; systemctl start irc.service
[Unit]
Description=Start screen with irssi on startup
After=multi-user.target
[Service]
Type=idle
ExecStart=/bin/su -l -c "screen -S irc -d -m irssi" username
[Install]
WantedBy=multi-user.target
package main
import (
"flag"
"log"
"os"
"os/signal"
"sync"
"time"
@gshimansky
gshimansky / kni.go
Created August 9, 2018 19:33
Monitor network interfaces IP addresses through netlink, print updates. Commented code sets up an IP address back if it is deleted.
// For forwarding testing call
// "insmod ./x86_64-native-linuxapp-gcc/kmod/rte_kni.ko lo_mode=lo_mode_fifo_skb"
// from DPDK directory before compiling this test. It will make a loop of packets
// inside KNI device and receive from KNI will receive all packets that were sent to KNI.
// For ping testing call
// "insmod ./x86_64-native-linuxapp-gcc/kmod/rte_kni.ko"
// from DPDK directory before compiling this test. Use --ping option.
// Other variants of rte_kni.ko configuration can be found here:
@gshimansky
gshimansky / loved.py
Created January 24, 2016 16:07
Download loved tracks from last.fm for local database. Get album name and date for collections where tracks are grouped by albums
import urllib2
import xml.etree.ElementTree as ET
import pickle
import time
def main():
# Gather required info.
lastfm_username = raw_input("Lastfm username: ").strip()
lastfm_key = raw_input("Lastfm API key: ").strip()
@gshimansky
gshimansky / lastfm_to_gmusic.py
Last active August 29, 2015 14:16 — forked from Timmmm/lastfm_to_gmusic.py
Get loved tracks from last.fm, convert into Google Music playlist, print not found tracks in the end
#!/usr/bin/env python
# Today is the 9th of March 2015.
#
# Not really tested!
#
# Instructions:
#
# 0. Install python and pip.
# 1. Download this to a file `lastfm_to_gmusic.py`