Skip to content

Instantly share code, notes, and snippets.

View jpalumickas's full-sized avatar
🚀
Hacking

Justas Palumickas jpalumickas

🚀
Hacking
View GitHub Profile
@jpalumickas
jpalumickas / devise.lt.yml
Last active October 5, 2023 12:23
Devise 3.2 Lithuanian translation
lt:
devise:
confirmations:
confirmed: "Jūsų el. pašto adresas sėkmingai patvirtintas."
send_instructions: "Už kelių minučių el. paštu gausite instrukcijas, kaip patvirtinti savo vartotoją."
send_paranoid_instructions: "Jei jūsų el. pašto adresas yra mūsų duomenų bazėje, kelių minučių bėgyje gausite laišką su patvirtinimo instrukcijomis."
failure:
already_authenticated: "Jūs jau esate prisijungęs."
inactive: "Jūsų vartotojas dar nepatvirtintas."
invalid: "Neteisingas el. paštas arba slaptažodis."
@jpalumickas
jpalumickas / osascript.rb
Last active July 1, 2021 11:36
osaScript Ruby examples
# === Terminal.app === #
# Open new tab in terminal.
exec("osascript -e 'tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down' > /dev/null 2>&1 ")
# Open directory
exec("osascript -e 'tell application \"Terminal\" to do script \"cd directory\" in selected tab of the front window' > /dev/null 2>&1 ")
# Open directory in new tab (this is better)
exec("osascript -e 'tell application \"Terminal\"' -e 'tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down' -e 'do script with command \"cd directory && clear\" in selected tab of the front window' -e 'end tell' > /dev/null 2>&1")
@jpalumickas
jpalumickas / mysql2-mojave.md
Created December 2, 2019 16:07 — forked from fernandoaleman/mysql2-mojave.md
Install mysql2 on MacOS Mojave

Problem

Installing mysql2 gem errors on MacOS Mojave.

Solution

Make sure openssl is installed on Mac via Homebrew.

brew install openssl
@jpalumickas
jpalumickas / memory.rb
Created July 10, 2018 08:19
Check memory usage for Process in Ruby
require 'benchmark'
def print_memory_usage
memory_before = `ps -o rss= -p #{Process.pid}`.to_i
yield
memory_after = `ps -o rss= -p #{Process.pid}`.to_i
puts "Memory: #{((memory_after - memory_before) / 1024.0).round(2)} MB"
end

Keybase proof

I hereby claim:

  • I am jpalumickas on github.
  • I am jpalumickas (https://keybase.io/jpalumickas) on keybase.
  • I have a public key ASAf0-1QmH7XuIEFN6csCSxI1Rh74yhfgiCGTYfj_qvpcQo

To claim this, I am signing this object:

# -*- encoding : utf-8 -*-
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
namespace :deploy do
namespace :assets do
desc <<-DESC
Run the asset precompilation rake task. You can specify the full path \
to the rake executable by setting the rake variable. You can also \
@jpalumickas
jpalumickas / rails_admin.lt.yml
Created December 26, 2013 11:15
Rails Admin Lithuanian I18n (not full translated)
lt:
admin:
js:
true: Taip
false: Ne
is_present: Is present
is_blank: Is blank
date: Data ...
between_and_: Tarp ... ir ...
today: Today
@jpalumickas
jpalumickas / Capfile
Created October 25, 2013 07:02
Automatically skip assets precompiling if no changes were made.
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
load 'deploy/assets'
Dir['config/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
require 'resque/errors'
class DatabaseBackupJob
def self.perform(id, foo, bar)
# do backup work
rescue Resque::TermException
# write failure to database
# re-enqueue the job so the job won't be lost when scaling down.
Resque.enqueue(DatabaseBackupJob, id, foo, bar)
# 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: