Skip to content

Instantly share code, notes, and snippets.

View qnub's full-sized avatar
👁️‍🗨️

Vadim Lopatiuk qnub

👁️‍🗨️
View GitHub Profile
@qnub
qnub / refresh.sh
Last active January 29, 2019 19:27
MTProxy (NATed VPS like scaleway/azure)
#!/usr/bin/env bash
# add to cron for daily update configs
CFG=/etc/mt-proxy
SECRET=https://core.telegram.org/getProxySecret
CONFIG=https://core.telegram.org/getProxyConfig
mkdir -p $CFG
curl -s $SECRET -o $CFG/proxy-secret
@qnub
qnub / README.md
Created December 17, 2018 10:23
PyCharm bytecode to regular string regex replacement

Select "Match case", "Regex" and set "File mask" to "*.py"

Search string: ([\n\s,=\+\[\{\(])b('[^\n]*?'|"[^\n]*?")([\n\s,\]\}\)])
Replace string: $1$2$3

@qnub
qnub / keyboard_remap.sh
Last active August 30, 2017 05:22
macOS 10.12+ keyboard remap script, check https://developer.apple.com/library/content/technotes/tn2450/_index.html to add you own remap options.
#!/usr/bin/env bash
echo "This script setup switch left alt/cmd and set caps-lock to f18 on user login"
cat << 'EOF' | sudo tee /usr/local/bin/me.qnub.pc-to-mac-kb.sh
#!/usr/bin/env bash
hidutil property --set '{"UserKeyMapping":
[{"HIDKeyboardModifierMappingSrc":0x7000000e2,
"HIDKeyboardModifierMappingDst":0x7000000e3},
{"HIDKeyboardModifierMappingSrc":0x7000000e3,
@qnub
qnub / README.md
Created April 5, 2017 20:07
DaVinci on Ubuntu x64 16.10

Download and install DaVinci with sudo. It'll be installed in /opt/resolve. Executing with resolve bin.

resolve require some additionla libraries to run:

wget http://fr.archive.ubuntu.com/ubuntu/pool/main/g/gst-plugins-base0.10/libgstreamer-plugins-base0.10-0_0.10.36-1_amd64.deb
wget http://fr.archive.ubuntu.com/ubuntu/pool/universe/g/gstreamer0.10/libgstreamer0.10-0_0.10.36-1.5ubuntu1_amd64.deb
sudo dpkg -i libgstreamer*.deb
sudo apt install libssl1.0.0 libssl-dev
cd /lib/x86_64-linux-gnu
@qnub
qnub / build.sh
Last active March 22, 2017 12:56
This gist will show you how to build a minimalist ffmpeg binary and OBS on Ubuntu 16.10
#!/usr/bin/env bash
git clone https://github.com/FFmpeg/FFmpeg -b master
cd FFmpeg
git pull
./configure --enable-shared --enable-gpl --enable-libass --enable-libfreetype --enable-libx264 --enable-libx265 --enable-nvenc --enable-nonfree --enable-libfdk-aac --disable-static
make -j$(nproc)
sudo checkinstall --pkgname=FFmpeg --fstrans=no --backup=no --pkgversion="$(date +%Y%m%d)-git" --deldoc=yes --install=yes --
showinstall=no
make -j$(nproc) distclean
@qnub
qnub / init.sh
Last active December 8, 2016 10:53
Init apt with proxy and install python2.7 for ansible
#!/usr/bin/env bash
HTTP_PROXY=$1
HTTPS_PROXY=$2
if [ -z "$HTTPS_PROXY" ]; then
HTTPS_PROXY=$HTTP_PROXY
fi
sudo mkdir -p /etc/apt/apt.conf.d
@qnub
qnub / btsync-secret
Created November 17, 2016 09:02 — forked from anonymous/btsync-secret
btsync-secret - A Bittorrent Sync Secret Generator
#!/usr/bin/env bash
#/ Usage: btsync-secret [option]...
#/ A Bittorrent Sync Secret Generator
set -e
h_flag=false
v_flag=false
e_flag=false
n_flag=false
c_flag=false
@qnub
qnub / fonts.conf
Last active July 7, 2022 00:37 — forked from BojanStipic/fonts.conf
Linux color emoji
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test qual="any" name="family"><string>DejaVu Sans</string></test>
<edit name="family" mode="assign" binding="same"><string>Noto Sans</string></edit>
</match>
<match target="pattern">
<test qual="any" name="family"><string>FreeSans</string></test>
<edit name="family" mode="assign" binding="same"><string>Noto Sans</string></edit>
@qnub
qnub / fabfile.py
Created March 25, 2016 09:10
Yandex.Disk shared file download by link
import os
import httplib
import json
import urllib
import urlparse
from fabric.api import execute, local, run, lcd, cd, task
@task
@qnub
qnub / README.md
Created March 12, 2016 06:01
Angular hints

$http.config for Django

angular.module('MyApp').config(function($httpProvider) {
  $httpProvider.defaults.xsrfCookieName = 'csrftoken';
  $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
  $httpProvider.defaults.headers
      .common['X-Requested-With'] = 'XMLHttpRequest';
  $httpProvider.defaults.headers
      .post['Content-Type'] = 'application/x-www-form-urlencoded';

});