Skip to content

Instantly share code, notes, and snippets.

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

Andriy Oblivantsev eSlider

🏠
Working from home
View GitHub Profile
package main
import (
"fmt"
"sort"
)
type Person struct {
Name string
Age int
@eSlider
eSlider / remove-duplicates.sh
Created May 2, 2020 15:10
Remote duplicates
#!/bin/bash
fdupes -rSdNI ./
@eSlider
eSlider / go-shell-script.go
Created February 27, 2020 13:19
Golang Shell Script
//usr/bin/env test -x $0 && (go build -o "${0}c" "$0" && "${0}c" $@; r=$?; rm -f "${0}c"; exit "$r"); exit "$?"
//
// The top "comment" defines shebang
// More over:
// * https://gist.github.com/posener/73ffd326d88483df6b1cb66e8ed1e0bd
// * https://getstream.io/blog/switched-python-go/
package main
import (
@eSlider
eSlider / Dockerfile
Last active December 22, 2019 14:57
Dramatically shrinking .net core 3.1 docker image publishing size
# Officia microsoft .NET SDK image
FROM mcr.microsoft.com/dotnet/core/sdk:latest AS api-build
# Set directory for build
WORKDIR /app
# Copy anything from where docker would be builded
COPY ./. ./
# Reice packages, Build and shrink as an standalone exutable file
@eSlider
eSlider / mbtiles2pbf.sh
Created September 24, 2019 13:53
Extract PBF tiles from mbtiles (SQLite)
#!/bin/sh
git clone https://github.com/mapbox/mbutil
cd mbutil
./mb-util --image_format=pbf *.mbtiles tiles
gzip -d -r -S .pbf *
find . -type f -exec mv '{}' '{}'.pbf \;
@eSlider
eSlider / spatialite_example.go
Created August 26, 2019 18:53 — forked from ptrv/spatialite_example.go
SpatiaLite example in Go
package main
import (
"database/sql"
"github.com/mattn/go-sqlite3"
"log"
"os"
)
func runQuery(db *sql.DB, query string) {
@eSlider
eSlider / get-org-name-by-host-name.sh
Created August 25, 2019 20:05
Get organisation name by hostname
#!/bin/sh
whois $(dig +short @1.1.1.1 produktor.io | head -1) | grep -Po "org-name\:\s+\K.+"
@eSlider
eSlider / stop-cpu-throttling.sh
Last active June 23, 2020 08:01
Fix broken DC cable connection and CPU throttling for HP Spectre x360
#!/bin/sh
# Determinate CPU capabilities
MAX_CPU=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq)
MIN_CPU=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq)
# Install MSR tools and Linux tools to get hack BIOS
# apt install -y msr-tools linux-tools-common linux-tools-$(uname -r)
@eSlider
eSlider / getThisFuckingObject.js
Last active July 20, 2018 22:16
Get over HTTPS
/**
* Get this fucking object
*
* @param {String} url URL я для http не учитывал
* @param {Function} onData(data) колбэк когда всё норм, будет вызван с уже готовым объектом
* @return {*}
*/
function getThisFuckingJsonObject(url, onData) {
let chunks = [];
return require('https').get(url, res => {
@eSlider
eSlider / build-cpay-lin.sh
Created July 16, 2018 12:48
Build cPay for linux
#!/bin/sh
# Requires:
# PPA="ppa:bitcoin/bitcoin"
# PACKAGES="cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev"
unset CC
unset CXX
unset DISPLAY