Skip to content

Instantly share code, notes, and snippets.

View ei-grad's full-sized avatar

Andrew Grigorev ei-grad

View GitHub Profile
import lzma
import requests
DEFAULT_CREDS = {
"url": "http://localhost:8123/",
"database": None,
"user": None,
"password": None,
import threading
import logging
from numpy.fft import fft, ifft
import numpy as np
import jack
def denoice(left, right):
fft_l = fft(left)
import argparse
import requests
def ask(query):
headers = {
'Accept': '*/*',
'Origin': 'https://yandex.ru',
'Accept-Language': 'ru',
@ei-grad
ei-grad / conda.conf
Created March 21, 2020 20:07
Nginx caching proxy for conda
# /etc/nginx/conf.d/conda.conf
proxy_cache_path /var/cache/nginx/conda levels=2:2 keys_zone=conda:100m inactive=14d max_size=10g;
upstream conda.anaconda.org {
server 104.17.92.24:443;
server 104.17.93.24:443;
}
server {
listen 80;
diff --git a/python/pyspark/cloudpickle.py b/python/pyspark/cloudpickle.py
index 88519d7311..f7ab821b97 100644
--- a/python/pyspark/cloudpickle.py
+++ b/python/pyspark/cloudpickle.py
@@ -72,77 +72,16 @@ else:
PY3 = True
-def _make_cell_set_template_code():
- """Get the Python compiler to emit LOAD_FAST(arg); STORE_DEREF
@ei-grad
ei-grad / fetch-updated-packages
Last active April 9, 2020 20:23
/etc/cron.hourly/fetch-updated-packages
#!/usr/bin/chronic /bin/bash
set -e
set -x
[ -n "`nmcli c show --active | grep -f /etc/fetch-allowed-wifi-networks`" ] || exit 0
pacman -S --refresh --sysupgrade --downloadonly --noconfirm
grep KeepCurrent /etc/pacman.conf && pacman -S --clean --noconfirm
@ei-grad
ei-grad / json_array_to_lines.go
Created November 28, 2019 13:09
Convert large JSON array to lines
package main
import (
"encoding/json"
"fmt"
"log"
"os"
)
func main() {
WS: /[ \t\f\r\n]/+
DIGIT: "0".."9"
INT: DIGIT+
FLOAT: DIGIT? "." DIGIT+
| DIGIT+ "."
int: INT
float: FLOAT
// simple types
from pathlib import Path
from urllib.parse import quote
index = []
for i in sorted(Path('.').iterdir()):
index.append(i)
with open('index.html', 'w') as f:
f.write('<html><body><center>')
@ei-grad
ei-grad / coordconv.py
Created August 6, 2019 14:42
Neat CoordConv channels injection implementation as a tensorflow.keras layer.
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Layer
class CoordinateChannel2D(Layer):
def call(self, inputs):
x = K.cast(K.arange(0, K.shape(inputs)[1]), K.floatx())
x /= K.cast(K.shape(inputs)[1], K.floatx())