This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# https://superuser.com/a/1536290 | |
# npm install -g asar | |
set -ex | |
killall slack || true | |
mkdir -p ~/tmp/slack | |
asar extract /usr/lib/slack/resources/app.asar ~/tmp/slack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# Usage: | |
# Place it in app/models/concerns dir | |
# | |
# Include in class | |
# class Product < ApplicationRecord | |
# include Truncatable | |
# end | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# add to /etc/rc.local | |
# su -c '/home/rails/scripts/talkzzz' | |
# | |
# add to /home/rails/.profile | |
# PATH=$HOME/scripts/:$PATH | |
# | |
APP="api_hd" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#возьмем, например, связь one-to-many и вложенными атрибутами | |
class Gallery < ActiveRecord::Base | |
has_many :images | |
accepts_nested_attributes_for :images | |
end | |
class Image < ActiveRecord::Base | |
belongs_to :gallery, required: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
driver: | |
name: vagrant | |
synced_folders: [ | |
["~/.chef/pkgs", "/tmp/chef-pkgs"] | |
] | |
provisioner: | |
name: chef_zero | |
chef_omnibus_url: file:///tmp/chef-pkgs/install.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Exchange | |
module ExternalAPI | |
class Nbkr < XML | |
API_URL = "http://nbkr.kg/XML/daily.xml" | |
CURRENCIES = %W(kgs usd eur kzt rub).map(&:to_sym) | |
def update opts={} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install wkhtmltopdf | |
apt-get install xvfb | |
echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/wkhtmltopdf.sh | |
chmod a+x /usr/bin/wkhtmltopdf.sh | |
ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf | |
wkhtmltopdf http://www.google.com output.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Throttler | |
class << self | |
def limit *attrs | |
throttler.limit *attrs | |
end | |
private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Добавляем репозиторий для oracle java | |
add-apt-repository ppa:webupd8team/java | |
# Добавляем репозиторий для elasticsearch | |
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - | |
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list | |
# Обновить систему | |
apt-get update && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get clean |
NewerOlder