Skip to content

Instantly share code, notes, and snippets.

@pmav99
pmav99 / balance.py
Created March 2, 2018 17:05 — forked from bbengfort/balance.py
Database transactions blog post.
#!/usr/bin/env python3
import os
import logging
import psycopg2 as pg
from decimal import Decimal
from functools import wraps
from psycopg2.pool import ThreadedConnectionPool
@pmav99
pmav99 / correlation_calculations2.ipynb
Created August 20, 2018 12:08
Correlation calculations.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
@pmav99
pmav99 / pysync
Last active September 2, 2018 17:08
pysync - A wrapper around `rsync`.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#author: Panagiotis Mavrogiorgos
#email: gmail, pmav99
"""
A wrapper around ``rsync``.
If the ``source`` or the ``destination`` directories are on a remote host
then you must specify the user and ip. E.g.
@pmav99
pmav99 / app.py
Created September 4, 2018 22:46
Flask + datatables + ajax
import numpy as np
import pandas as pd
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
MY_DATA = pd.DataFrame(np.random.random((10000, 3)), columns=["a", "b", "c"])
@app.route('/index')
@app.route('/')
@pmav99
pmav99 / skylake-tuning-linux.md
Created September 28, 2018 13:25 — forked from Brainiarc7/skylake-tuning-linux.md
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running:

@pmav99
pmav99 / Scala.For.The.Impatient.md
Created October 19, 2018 10:03 — forked from hhimanshu/ Scala.For.The.Impatient.md
Scala for the Impatient Exercises

This gist will contain all the exercises from the book

@pmav99
pmav99 / split_keyboards.md
Created November 3, 2018 11:38 — forked from itod/split_keyboards.md
Every "split" mechanical keyboard currently being sold that I know of
@pmav99
pmav99 / python27.py
Last active November 19, 2018 13:41
Get the first unique character of a string. Python - single traversal solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import OrderedDict
def find_index_of_first_unique_char(string):
seen_once = OrderedDict() # LinkedHashMap
seen_many = set() # HashSet
for index, char in enumerate(string): # O(N)
@pmav99
pmav99 / popen.md
Created January 29, 2019 23:27 — forked from achillesrasquinha/popen.md
A Python Popen that does not suck.

A Python Popen that does not suck.

Function

import os
import subprocess

def popen(*args, **kwargs):
    output      = kwargs.get('output', False)
    directory   = kwargs.get('dir')