Skip to content

Instantly share code, notes, and snippets.

View a0s's full-sized avatar
🔬
Lets automate everything

Anton Osenenko a0s

🔬
Lets automate everything
View GitHub Profile
@alexsegura
alexsegura / text.md
Last active September 3, 2018 13:49
Scaleway private server
@fcalderan
fcalderan / inception-javascript.js
Created November 2, 2010 09:42
inception explained as a 4 nested javascript closures
/*
* Fabrizio Calderan, twitter @fcalderan, 2010.11.02
* I had an idea: could Inception movie be explained by a few javascript closures
* and variable resolution scope (just for fun)?
*
* Activate javascript console =)
*/
<script>
console.group("inception movie");
#!/bin/sh -x ## or just ` curl -Ls http://git.io/vRozn | sh `.
## Downloads the Mac OS X 10.10 Recovery Partition update,
## Copy's over the 10.10 version of Disk Utility.app, then
## use git to apply a binary patch so it will run on 10.11+.
cd /tmp
rm -rf DU1010
mkdir DU1010
@shannonwells
shannonwells / socksify_faraday.rb
Last active May 7, 2021 20:52
Faraday + SOCKS
require 'rubygems'
require 'faraday'
require 'socksify'
require 'socksify/http'
require 'awesome_print'
# This is a SOCKS monkey patch for Faraday, with example use/unit test.
# Notes:
# * It is altered to work with SOCKS5 authentication.
# * net_http_class must return a Faraday::Adapter::NetHttp instance.
@lvisintini
lvisintini / README.md
Last active July 2, 2022 08:44
How to install VisualSFM on Ubuntu 16.04 (64-bit)
@carlosedp
carlosedp / install_container_service.sh
Created February 21, 2018 16:21
Install Container services (Docker/Kubernetes) on Debian/Ubuntu
#!/bin/bash
echo "Container Linux installation script"
echo "This will install:"
echo " - Docker Community Edition"
echo " - Docker Compose"
echo " - Kubernetes: kubeadm, kubelet and kubectl"
echo ""
set -xeo pipefail
with table_stats as (
select psut.relname,
psut.n_live_tup,
1.0 * psut.idx_scan / greatest(1, psut.seq_scan + psut.idx_scan) as index_use_ratio
from pg_stat_user_tables psut
order by psut.n_live_tup desc
),
table_io as (
select psiut.relname,
sum(psiut.heap_blks_read) as table_page_read,
@nickjacob
nickjacob / systemd-prblm.service
Last active March 17, 2023 16:11
execute arbitrary bash code/variable substitution in systemd units
[Unit]
Description=Demonstrate Bash
[Service]
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment MYVAR=$(( 2 + 2 ))"
ExecStart=/usr/bin/echo "2 + 2 = ${MYVAR}"
@jnx
jnx / rbenv-install-system-wide.sh
Created October 1, 2011 20:09
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@davydovanton
davydovanton / text.md
Last active August 11, 2023 13:33
Рефакторинг сервис объекта с монадами и AR

https://t.me/pepegramming

Сегодня попался рельсовый код, в котором используются монады, сервисы и прочее. Решил сделать обзор с объяснением того, что в коде не нравится и что можно исправить.

Данный разбор основан только на личном опыте и избегает попытку написать самый идеальный код на свете. К сожалению пошарить ссылку на код не могу, потому что автор попросил опубликовать анонимно.

Исходные данные

Главная операция, которая вызывается из контроллера выглядит следующим образом: