Skip to content

Instantly share code, notes, and snippets.

View artkirienko's full-sized avatar
🌇
Working remotely @ Vancouver, Canada

Artem Kirienko artkirienko

🌇
Working remotely @ Vancouver, Canada
  • https://pressreader.com
  • Vancouver, Canada
  • 01:30 (UTC -07:00)
  • LinkedIn in/artkirienko
View GitHub Profile
@artkirienko
artkirienko / calc.html
Last active August 29, 2015 14:20
Калькулятор стоимости поддержки — первая линия ColumbusCare
<!DOCTYPE html>
<html>
<head>
<title>Калькулятор стоимости поддержки — первая линия ColumbusCare</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
/*
* Калькулятор стоимости поддержки — первая линия ColumbusCare
*/
function calc() {
@artkirienko
artkirienko / sidekiq.service
Last active September 14, 2015 09:47
sidekiq.service
#
# systemd unit file for CentOS 7, Ubuntu 15.04
#
# Customize this file based on your bundler location, app directory, etc.
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
#!/bin/bash
while true
do
psql soms_production -f /var/lib/pgsql/update_soms.sql
sleep 5
done
@artkirienko
artkirienko / change_passwords.rb
Last active September 17, 2015 07:33
run at your application path within rails console
f = File.new("passwords", 'w')
User.all.each do |u|
psw = ([*('A'..'Z'),*('0'..'9')]-%w(0 1 I O)).sample(8).join
office = u.office_id.nil? ? " " : u.office.name
f.write("office: #{office} fio: #{u.first_name} #{u.middle_name} #{u.last_name} email: #{u.email} password: #{psw}\n\n")
u.password = psw
u.password_confirmation = psw
u.save
end
@artkirienko
artkirienko / run_on_local_machines.sh
Last active September 23, 2015 15:55
Rails import multiple local databases into one global
# (я решил не использовать grep / sed для анализа и редактирования каждго дампа,
# так как при помощи SQL-запросов я быстрее решу ту же задачу)
# шаг 0
# выгружаем из каждого локально развернутого приложения дамп базы данных
# suo_local - база из которой сгружаем
# db.sql - файл в который выгружаем
pg_dump suo_local -t slots -t conversation_fs -t users -t board_settings -t office_settings \
-t offices -t portal_tickets -t day_schedules -t activities -t register_action_normatives -t service_normatives \

Post Upgrade to El Capitan, with Homebrew & Ruby

... and Xcode and Java, etc.

Prepare

If you don't already have homebrew installed, do that first, so you don't have to deal with SIP issues. Install all Software Updates available in the Apple Menu, up to and including El Capitan.

Hardware

@artkirienko
artkirienko / 00-README.txt
Last active October 21, 2015 12:33
Final import
Подготовка [один раз]:
- Создать директорию /new (в корне системы) [один раз]
mkdir /new
cd /new
• Скопировать все файлы в директорию [один раз]:
git clone https://gist.github.com/529a563a1e1f621a5eec.git
• Подключиться по ssh к серверу БД:
ssh root@10.128.26.6
• Перейти в директорию
cd /new/529a563a1e1f621a5eec
@artkirienko
artkirienko / admins_pass.rake
Created October 23, 2015 08:31
admins_pass.rake
namespace :admins_pass do
task :generate => :environment do
ids = []
ids += (8..39).to_a
ids += [50, 48, 40, 42, 43, 44, 45, 46]
f = File.new("pas_admins", 'w')
ids.each do |id|
psw = ([*('A'..'Z'),*('0'..'9')]-%w(0 1 I O)).sample(8).join
@artkirienko
artkirienko / сцанина
Created October 27, 2015 11:40
сцанина
#!/bin/bash
ip=$1
ADDR="`cat ./upd_hosts | grep $ip | awk -F ':' {'print $1'}`"
if ping -c 3 $ip >/dev/null
then
#version=$(expect get-suo-version1.exp $ip | tee -a $LOG | grep APP_VERSION | cut -d = -f 2 | tr -d "\r" | tr -d \')
text=`expect get-suo-version1.exp $ip`
version=$(echo $text | grep VERSION | cut -d = -f 2 | tr -d "\r" | cut -d \' -f 2)
@artkirienko
artkirienko / controller.rb
Last active December 1, 2015 15:19
Модель, например
if params[:date]
@date = Date._strptime(params[:date], '%m-%Y')
unless Date.today.month == @date[:mon] && Date.today.year == @date[:year]
@showings = Showing.by_date(@date)
end
end