Skip to content

Instantly share code, notes, and snippets.

View adaRn's full-sized avatar

Adam S. adaRn

View GitHub Profile
@adaRn
adaRn / DatabaseCleaner cleaning database too early.md
Created August 14, 2017 10:23
DatabaseCleaner cleaning database too early (Capybara, PhantomJS, poltergeist)

Solution:

In your helper change

config.after(:each) do
  DatabaseCleaner.clean
end

to

@adaRn
adaRn / Ruby list of countries with their codes ISO 3166-1 alpha-2.rb
Last active September 8, 2021 12:13
Ruby. Array of countries with their codes. According to ISO 3166-1 alpha-2 (two-letter codes). Based on https://gist.github.com/vxnick/380904
[{:name=>"Afghanistan", :code=>"AF"},
{:name=>"Aland Islands", :code=>"AX"},
{:name=>"Albania", :code=>"AL"},
{:name=>"Algeria", :code=>"DZ"},
{:name=>"American Samoa", :code=>"AS"},
{:name=>"Andorra", :code=>"AD"},
{:name=>"Angola", :code=>"AO"},
{:name=>"Anguilla", :code=>"AI"},
{:name=>"Antarctica", :code=>"AQ"},
{:name=>"Antigua And Barbuda", :code=>"AG"},
@adaRn
adaRn / etc logrotate.d openvpn
Created August 15, 2019 14:33
This is logrotate configuration for OpenVPN. It prevents you from huge OpenVPN log files. `copytruncate` option here is very important - OpenVPN doesn't want to close the logfile it's writing to, so this file is automatically truncated after copying its contents.
/var/log/openvpn.log {
daily
rotate 12
compress
copytruncate
delaycompress
missingok
notifempty
}
@adaRn
adaRn / facebook-fanpage-images.rb
Created September 12, 2019 05:50
crawl facebook fanpage images
require 'nokogiri'
require 'open-uri'
require 'uri'
# url = 'https://www.facebook.com/LifeFitness'
# for fanpages with videocover, it won't find the cover
url = 'https://www.facebook.com/cleverfit.dornach'
@adaRn
adaRn / ipsec-vpn-server.yaml
Created October 27, 2019 23:25
Kubernetes YAML to deploy IPSec VPN server (statefulset)
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
name: vpn
spec:
selector:
matchLabels:
app: vpn
serviceName: vpn
replicas: 1