Skip to content

Instantly share code, notes, and snippets.

View JuPlutonic's full-sized avatar
💭
🍺

AMZ JuPlutonic

💭
🍺
  • Msk, Russian Fed.
View GitHub Profile
## Environment normalisation
# Ignore bundler config.
/.bundle
/vendor/bundle
/lib/bundler/man/
# Unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
@JuPlutonic
JuPlutonic / install_ruby.bash
Last active May 17, 2017 23:07 — forked from aereal/install_ruby.bash
Changed compil. flags for my configuration, ver. chgd to 2.2.7, debugflags="-ggdb3" optimization and clang rmvd fr. R_C_O_ARRAY _NOT TESTED
#!/bin/bash
PATH=$(rbenv root)/bin:$(rbenv root)/plugins/ruby-build/bin:$PATH
version=${1:-2.2.7}
trap 'exit 1' 2
eval "$(rbenv init -)"
require 'thread'
# ##################################
# Ruby anti-race conditions workshop
# ##################################
class Sheep
def initialize
@shorn = false
end
require 'thread'
# ##################################
# Ruby anti-race conditions workshop
# ##################################
# Eliminating interleavings at lines 22-25 with '''Mutex'''
# But you shouldn't write code like this in a multi-threaded environment:
# Whenever you have multiple threads sharing a reference to an object,
# and making modifications to it, you're going to run into trouble
# unless you have some kind of locking in place to prevent a context switch
# Lazy initialization is another form of
# the check-then-set race condition.
# The ||= operator effectively expands to
@logger ||= Logger.new
# expands to
if @logger == nil
@logger = Logger.new
@JuPlutonic
JuPlutonic / rubygems-update_generated_script
Created November 3, 2017 21:50
undefined method `files=' for nil:NilClass
#!/usr/bin/ruby2.4
#
# This file was generated by RubyGems.
#
# The application 'rubygems-update' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
@JuPlutonic
JuPlutonic / monit.rc
Created May 25, 2018 13:25 — forked from vkurennov/monit.rc
Пример конфига для запуска процессов через monit
### Nginx ###
check process nginx with pidfile /opt/nginx/logs/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
if cpu > 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if memory usage > 80% for 5 cycles then restart
if failed host 127.0.0.1 port 80 protocol http
then restart
if 3 restarts within 5 cycles then timeout

GnuPG Packaging

A few items here assume zsh as shell (globs and expansion modifiers, print -l).

Required installation order:

Previously recorded:
gmp nettle gnutls npth libgpg-error libgcrypt libksba libassuan  ( pinentry , gnupg )
@JuPlutonic
JuPlutonic / # libtorrent-rasterbar - 2019-01-05_07-57-51.txt
Last active January 5, 2019 08:05
libtorrent-rasterbar on Ubuntu 18.10 - Homebrew build logs
Homebrew build logs for libtorrent-rasterbar on Ubuntu 18.10
Build date: 2019-01-05 07:57:51
=========================================================================================================
Before and after migration on /home/linuxbrew/.linuxbrew/Homebrew $HOMEBREW_REPOSITORY,
before and after I sourced zsh without export$PATH="BLAH-BLAH-BLAH/.pyenv/shims:$PATH" (terminal restarted, zcomdump removed).
libtorrent-rasterbar formula can't be compiled at all (no binary bottle presented)
@JuPlutonic
JuPlutonic / spring_2.0.2.txt
Last active February 6, 2019 09:11
Rails/Spring
Fetching https://github.com/rails/spring.git
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 12.0.0
Using concurrent-ruby 1.0.5
Using i18n 0.8.6
Using minitest 5.10.3