Skip to content

Instantly share code, notes, and snippets.

View dpsk's full-sized avatar
🏠
Working from home

Mikhail Nikalyukin dpsk

🏠
Working from home
View GitHub Profile
@dpsk
dpsk / deploy.rb
Created July 5, 2012 12:42 — forked from mikhailov/0. nginx_setup.sh
Nginx+Unicorn (production-ready setup)
# Capistrano configuration
#
# require 'new_relic/recipes' - Newrelic notification about deployment
# require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production.
# set :deploy_via, :remote_cache - fetch only latest changes during deployment
# set :normalize_asset_timestamps - no need to touch (date modification) every assets
# "deploy:web:disable" - traditional maintenance page (during DB migrations deployment)
# task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP
@dpsk
dpsk / gist:993862
Created May 26, 2011 19:27 — forked from ndbroadbent/gist:971255
Deploy Fat Free CRM (rails3 branch) to a freshly installed Ubuntu machine.
#!/bin/bash
#
# => $ sudo apt-get install -y --force-yes curl; sudo su - -c "bash < <(curl -sL http://is.gd/..........)"
#
# Deploy Fat Free CRM (rails3 branch) to a freshly installed Ubuntu machine.
# --------------------------------------------------------------------------
#
# Steps:
#
# *) Install required packages (git, postgresql, etc.)
@dpsk
dpsk / video_url.rb
Created November 27, 2019 10:42
Small lib for extracting provider and video id from url
class VideoUrl
YOUTUBE_FORMATS = [
%r(https?://youtu\.be/(.+)),
%r(https?://www\.youtube\.com/watch\?v=(.*?)(&|#|$)),
%r(https?://www\.youtube\.com/embed/(.*?)(\?|$)),
%r(https?://www\.youtube\.com/v/(.*?)(#|\?|$)),
%r(https?://www\.youtube\.com/user/.*?#\w/\w/\w/\w/(.+)\b)
]
VIMEO_FORMATS = [
Gvirabi = {
obfuscateHost: function(host) {
var obfuscated = '';
for (var i = 0; i < host.length; i++) {
obfuscated += host[i] + "g";
}
return obfuscated;
},
getCookieObj: function(obj) {
if (obj != document) {
@dpsk
dpsk / api.rb
Created February 3, 2016 17:54
basic example on how to use xml api with grape
module API
class Base < Grape::API
mount API::V1::ApplicationV1 => "/api"
end
end
@dpsk
dpsk / moc-on-osx.md
Last active December 24, 2015 21:49 — forked from RobertAudi/moc-on-osx.md
Remove Growl script. Add apple notification center script instead

MOC on OS X

I waited for years for a Homebrew formula for MOC. I finally found one today, but it didn't work for me. So I decided to try to compile it from source.

Requirements

Here is a list of requirements, taken directly from the MOC README:

@dpsk
dpsk / README.md
Last active December 17, 2015 12:38

Commands examples

If the namespace is not used then the commands will perform on top of the default database. bundle exec rake db:create bundle exec rake db:migrate

By using the namespace we are going to use all the configuration for our alternate DB. bundle exec rake store:db:create bundle exec rake store:db:migrate

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

_G.bicycle = {
action = { },
basket = { },
access = function (path)
local file = io.open(path, "r")
if file == nil then return false end
io.close(file)

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: