Skip to content

Instantly share code, notes, and snippets.

Avatar

R Gibim Drowze

  • Fusioneer Software
  • Dublin, Ireland
  • Twitter @r_gibim
View GitHub Profile
@Drowze
Drowze / INSTRUCTIONS.md
Last active Jul 3, 2021
Setting up a Plex Media Server VM (tested with Virtualbox) with ubuntu server (tested on 16 LTS)
View INSTRUCTIONS.md

DISCLAIMER

Tested under Windows 10 Pro host (1709), Ubuntu server 16 LTS guest, VirtualBox 5.2.4.
Hardware: AMD FX 6300, 8GB Ram (VGA should not matter).

Step-by-step

  • Download Virtualbox and set up a VM with Ubuntu Server (I used 16 LTS). Take note of the VM name.
  • With the VM closed, configure the network adapter as bridged.
  • Install the Ubuntu server normally. Take note of your username (duh!).
  • Add the plex repositories and add the key as trusted:
@Drowze
Drowze / docker-in-docker-issue.md
Last active May 17, 2021
docker in docker, issues with mounting a volume
View docker-in-docker-issue.md

Let's try to use volumes on a docker-in-docker setup!

  • First start docker in docker
$ docker pull docker
$ docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --name docker-outer docker sh
  • Then start an inner container, create a file there and copy it to the outer container
View MedievalNetwork.md

Medieval Network!

In the early middle ages, where magic reigns and the dragons breath, the world nearly came to an end if not by the bravery of the mightiest wizards.
Those, who do their magic writing lines of gibberish language may now save the humanity, but not without a social network to orchestrate their plans.

Features that shall belong

Such a crucial network shall never see the light of the day having it not the following:

  • Wizard creation
    A wizard has no less than the following: name, age, gender, location (lat,long).
    A wizard has a bag as well, which shall be filled with gold, food, beer, life potions and mana potions (however those should be described during creation - after that one can only obtain items by trading with others!)
View graylog_api.rb
require 'bundler/inline'
require 'minitest/autorun'
gemfile do
source 'https://rubygems.org'
gem 'http'
end
require 'http'
require 'cgi'
@Drowze
Drowze / wallhaven.rb
Last active Mar 22, 2020
Ruby script to scrap wallpapers from Wallhaven. Also provided a way to automatically use a downloaded wallpaper #wallhaven #ruby
View wallhaven.rb
require 'mechanize'
class WallHaven
BASE_URI = 'https://wallhaven.cc'
def initialize(limit: 24, human_download: false)
@agent = Mechanize.new
@limit = limit.to_i
@human_download = human_download
end
View gist:d73fc62c4fd31d1cf6958b340900f723
RSpec.describe 'Testing' do
it 'is flagged' do
x = []
expect { x.append(1) }.to change(x, :size)
end
end
@Drowze
Drowze / test.rb
Last active Jun 20, 2019
RSpec bug on allow with block syntax #rspec #ruby #bug #bug-report
View test.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rspec'
end
puts 'Ruby Version ' + RUBY_VERSION.to_s
puts 'RSpec version ' + RSpec::Core::Version::STRING.to_s
@Drowze
Drowze / compositional_fun.rb
Last active Jun 7, 2019
composition operator fun (using ruby 2.7 preview 1)
View compositional_fun.rb
class SubtractTwoInteraction
def self.call(number)
number - 2
end
end
class MultiplyByInteraction
def self.call(number:, by:)
number * by
end
@Drowze
Drowze / Suppressing undesired gem load.md
Created Sep 26, 2018
Suppressing undesired gem/library load. Useful when your project has a undesired gem being loaded. This makes advantage of .pryrc (but irbrc could theorically also be used)
View Suppressing undesired gem load.md

My project .pryrc contained awesome_print load, which I do not appreciate.

require 'awesome_print'
AwesomePrint.pry!

To patch against the .pryrc, which I could not edit at the time, I created another .pryrc at my home folder (~/.pryrc):

module Kernel
  alias :old_require :require
View vmux.fish
function vmux --description 'Use tmux inside vagrant instance'
vagrant ssh -- -t 'tmux attach $@'
end