Skip to content

Instantly share code, notes, and snippets.

@gtors
gtors / gist:effe8eef7dbe7052b22a009f3c7fc434
Created December 10, 2018 12:57
Makefile -> compilation_commands.json
@gtors
gtors / celery_environ.py
Created October 31, 2018 12:24
Celery + Environ
# Celery (4.2)
# http://docs.celeryproject.org/en/latest/userguide/configuration.html
from datetime import timedelta
from libs.env import env
PREFIX = 'PRJ'
# General settings
CELERY_ACCEPT_CONTENT = env.list(
f'{PREFIX}_CELERY_ACCEPT_CONTENT', default=['json'])
@gtors
gtors / mime-types
Created October 17, 2018 09:44
Common mime types
_XLSX_MIME = (
"application/" +
"vnd.openxmlformats-officedocument.spreadsheetml.sheet")
FILE_TYPE_MIME_TABLE = {
"csv": "text/csv",
"tsv": "text/tab-separated-values",
"csvz": "application/zip",
"tsvz": "application/zip",
pacman -S 7z aria2 asciinema autoconf automake binutils binwalk caddy calibre clang cmake coreutils cronie cython docker elfutils elixir enca erlang ethtool exfat-utils fakeroot ffmpeg file filezilla findutils firefox fzf gcc gdb git go graphviz gzip hopper htop iputils libuv llvm ltrace make mplayer nasm ncurses pip postgis postgresql pulseaudio qt5 rabbitmq readline redis ripgrep sed strace systemtap tcpdump tor unrar unzip usbutils vifm vim vlc wget wine wireshark wpa_actiond wpa_supplicant wps-office yasm zathura zeromq zlib zstd
@gtors
gtors / kibana_hits.py
Created September 3, 2018 11:38
Unload logs from kibana
#!/usr/bin/evn python
# Dependencies:
# pip3 install ujson ipdb tqdm requests
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import sys
@gtors
gtors / enhance.js
Last active July 3, 2018 10:13
GreaseMonkey script for YouTrack
// ==UserScript==
// @name Enhance YT
// @namespace youtrack
// @description Enhance YT
// @include https://.../youtrack/issue/*
// @version 1
// @run-at document-end
// @grant none
// ==/UserScript==
@gtors
gtors / main.go
Last active June 8, 2018 07:14
Grab Solaris / AT&T to Intel notation mapping
package main
import (
"fmt"
"regexp"
"strings"
"encoding/json"
"github.com/gocolly/colly"
gq "github.com/PuerkitoBio/goquery"
)
clang-check -extra-arg=-std=c17 -ast-dump file.c
clang-chack -ast-dump-filter=structname -ast-dump file.c
@gtors
gtors / clean.py
Last active October 27, 2017 09:31
Remover of multiline comments
#!/usr/bin/env python3
import re
import os
import sys
multiline_coment = re.compile(r'/\*\*.+?\*/\n?', flags=re.DOTALL)
extensions = tuple('.' + ext for ext in (
'java',
))
@gtors
gtors / rec_dep.sql
Created December 21, 2016 08:27
(PG) Recursive dependencies of a single database object
-- https://codereview.stackexchange.com/questions/23181/get-all-recursive-dependencies-of-a-single-database-object
WITH RECURSIVE dep_recursive AS (
-- Recursion: Initial Query
SELECT
0 AS "level",
'company' AS "dep_name", -- <- define dependent object HERE
'' AS "dep_table",
'' AS "dep_type",
'' AS "ref_name",