Skip to content

Instantly share code, notes, and snippets.

View nalcheg's full-sized avatar
🏠
Working from home

Andrew Tugarinov nalcheg

🏠
Working from home
View GitHub Profile
### Keybase proof
I hereby claim:
* I am nalcheg on github.
* I am nalcheg (https://keybase.io/nalcheg) on keybase.
* I have a public key ASBcrwlKVOiUUbEtPRCoTQMcmZGpcgn9gQ3t8R9a62Exego
To claim this, I am signing this object:
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
"sync"
@nalcheg
nalcheg / magnet.bash
Created January 13, 2020 15:29
magnet links to .torrent files converter
#!/bin/bash
## usage: ./download_magnet_url.sh "magnet_link"
## magnet link shoul be enclosed in quotes.
cd ./torrent_auto # set your watch directory here
[[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit;
echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent"
@nalcheg
nalcheg / gist:9327a9a81e44daa8a922dccf1d9cd50f
Created December 29, 2019 09:25
Go db drivers/orm benchmark
BenchmarkPgx-4 2466 527680 ns/op
BenchmarkSqlx-4 1868 619418 ns/op
BenchmarkGorm-4 351 3069103 ns/op
#!/usr/bin/env bash
again="yes"
while [ "$again" = "yes" ]
do
LASTRULE="$(iptables -nvL INPUT --line | fgrep 'virbr0' | cut -d' ' -f1 | head -c 1)"
if [[ -n "${LASTRULE}" ]]
then
iptables -D INPUT ${LASTRULE}
echo "iptables -D INPUT ${LASTRULE}"
@nalcheg
nalcheg / fix-webogram.js
Last active March 20, 2019 12:21 — forked from sulami/fix-webogram.js
telegaFullWidth
// ==UserScript==
// @name Fix Webogram width
// @namespace webogram.fixes
// @match https://web.telegram.org/*
// @version 2
// @grant none
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
@nalcheg
nalcheg / state.sh
Created November 18, 2018 14:03
get bitcoin (and others same coins) node sync state
#!/usr/bin/env bash
coin="$1";
if [ -z $coin ]; then
/bin/echo "No coin given... using btc as default";
coin="bitcoin";
fi
count=$(${coin}-cli getblockcount);
/bin/echo "block count: $count";
@nalcheg
nalcheg / gist:a7cb540e9b220a0b89ca046c795cacc8
Created January 2, 2018 13:16
kubernetes volumes and nfs
apiVersion: v1
kind: Pod
metadata:
name: sharevol
spec:
containers:
- name: c1
image: centos:7
command:
- "bin/bash"
@nalcheg
nalcheg / backupMariadbToSelf.bash
Created December 7, 2017 04:35
xtrabackup on self backup script
#!/bin/bash
TODAY=`date +"%Y-%m-%d"`
echo "==`date`== BEGIN XTRABACKUP ====================================" >> /var/log/xtralog
ulimit -n 4094
rm -fr /var/backups/xtrabackupCurrent
xtrabackup --user=user --password=password --backup --target-dir=/var/backups/xtrabackupCurrent
xtrabackup --user=user --password=password --prepare --target-dir=/var/backups/xtrabackupCurrent
@nalcheg
nalcheg / set_irq_affinity
Created December 2, 2017 02:38
from Intel(R) igb v. 5.3.5.12 driver
#!/bin/bash
#
# Copyright (c) 2015, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright