I hereby claim:
- I am amit on github.
- I am journeyer (https://keybase.io/journeyer) on keybase.
- I have a public key ASB5OdF37yxSMnNG3m_BEpAydHdK2bhVspSMkW0_k3V8TAo
To claim this, I am signing this object:
threads = [] | |
(0..4).each do | |
threads << Thread.new { | |
row = XAuth::Variable.where(name: "current_member_id").first_or_create | |
row.with_lock do | |
sleep(2) | |
oldvalue = row.value.to_i | |
newvalue = oldvalue + 1 | |
row.value = newvalue | |
row.save! |
I hereby claim:
To claim this, I am signing this object:
#!/bin/bash | |
# This script checks if the root user can access SSH server on this machine | |
FILE="/etc/ssh/sshd_config" | |
if ! [[ -r $FILE ]] | |
then | |
echo "Unable to read $FILE" | |
exit 1 | |
fi |
require 'socket' | |
require 'json' | |
class AircraftPositionStream | |
def initialize host, port | |
@host = host | |
@port = port | |
end |
# Harshad numbers are divisible by sum of their digits. e.g. 1729 (1+7+2+9=19 and 19*91=1729 | |
# https://en.wikipedia.org/wiki/Harshad_number | |
# Sum of digits of a (positive) number: q | |
q = 987654321 | |
puts q.to_s.split('').reduce{|sum, n| sum.to_i + n.to_i}.to_i | |
# Find Harshad number between 1 and 1000: | |
puts (1..1000).select{|q| q % q.to_s.split('').reduce{|sum, n| sum.to_i + n.to_i}.to_i == 0} |
This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.
No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!
I chose [pgloader
][1] because it's extremely fast. YMMV.
mysql2
gem with pg
in Gemfile
.config/database.yml
for PostgreSQL. I used [Rails' template][2] as a starting point.@binkmail.com | |
@bobmail.info | |
@chammy.info | |
@devnullmail.com | |
@letthemeatspam.com | |
@mailinater.com | |
@mailinator.net | |
@mailinator2.com | |
@notmailinator.com | |
@reallymymail.com |
@binkmail.com | |
@bobmail.info | |
@chammy.info | |
@devnullmail.com | |
@letthemeatspam.com | |
@mailinater.com | |
@mailinator.net | |
@mailinator2.com | |
@notmailinator.com | |
@reallymymail.com |
# apt install postgresql-client | |
# apt-get -y install bash-completion wget | |
# wget --no-check-certificate --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - | |
# echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list | |
# apt-get update | |
# apt-get -y install postgresql-client-12 | |
namespace :db do | |
desc "Dumps the database to backups" |