Skip to content

Instantly share code, notes, and snippets.

View doromones's full-sized avatar
🚀
per rectum ad astrum

Anton doromones

🚀
per rectum ad astrum
  • Starladder
  • Ukraine, Kiev
  • 09:12 (UTC +02:00)
View GitHub Profile
@doromones
doromones / yubikey-windows10.md
Created August 4, 2021 19:41 — forked from andreibosco/yubikey-windows10.md
Setting up Yubikey with SSH and Git on Windows 10 + Powershell
@doromones
doromones / Dockerfile
Created December 10, 2019 16:14 — forked from erdostom/Dockerfile
Good starter Dockerfile + docker-compose.yml for Rails 6.
FROM ruby:2.6.3-alpine
RUN apk add --update --no-cache bash build-base nodejs sqlite-dev tzdata postgresql-dev yarn
RUN gem install bundler:2
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn install --check-files
@doromones
doromones / geonames_postgres.rb
Last active June 3, 2019 16:57 — forked from kaspergrubbe/geonames_postgres.rb
Import files from Geonames.com into a PostgreSQL database that runs Postgis
#!/usr/bin/env ruby
require 'open3'
require 'fileutils'
require 'tempfile'
CITIES_POPULATION = 500
LANGS = %w(ru en uk zh tr)
IN_LANGS_QUERY_STR = LANGS.map{|w| "'#{w}'"}.join(',')
def run_command(command)
@doromones
doromones / SSL-certs-OSX.md
Created April 4, 2018 09:25 — forked from croxton/SSL-certs-OSX.md
Generate ssl certificates with Subject Alt Names

Generate ssl certificates with Subject Alt Names on OSX

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

DNS.1   = my-project.dev

Additional FQDNs can be added if required:

@doromones
doromones / ngxdis
Created April 2, 2018 10:21 — forked from fideloper/ngxdis
Nginx scripts for enable and disabling a site. This will create or destroy a symlink between a real config file in /etc/nginx/sites-available and a symlink in /etc/nginx/sites-enabled.
#!/usr/bin/env bash
if [ $EUID -ne 0 ]; then
echo "You must be root: \"sudo ngxdis\""
exit 1
fi
# -z str: Returns True if the length of str is equal to zero.
if [ -z "$1" ]; then
echo "Please choose a site."
@doromones
doromones / db.rake
Created December 10, 2016 21:13 — forked from asciant/db.rake
Add epoch to filename
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
epoch = Time.now.to_i
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}-#{epoch}.dump"
end
@doromones
doromones / comment_policy.rb
Last active April 8, 2018 02:47 — forked from tomchentw/comment_policy.rb
Implementation of ActiveAdmin::PunditAdapter and usage of Pundit with ActiveAdmin. A PR is opened here : https://github.com/gregbell/active_admin/pull/2857
# app/policies/active_admin/
module ActiveAdmin
class CommentPolicy < ApplicationPolicy
class Scope < Struct.new(:user, :scope)
def resolve
scope
end
end
end
end
@doromones
doromones / emoji.md
Last active April 8, 2018 01:47 — forked from Nitrino/emoji.md
ios emoji in rails + mysql

Emoji in Rails + MySQL

UTF8 содержит три байта на символ, что не в полной мере отражает такие языки как японский. В ios используются смайлы emoji тоже пришедшие из японии и старая версия utf8 использующая 3 байта на символ их не поддерживает. Новая версия utf8 (utf8mb4) использует 4 байта на символ и в полной мере поддерживает все языки и спецсимволы. MySQL c версии 5.5.3 поддерживает utf8mb4

Для поддержки emoji нужно конвертировать нужную таблицу или всё базу в utf8mb4. Сделать это можно с помощью команд: Для базы:

@doromones
doromones / AngularBaseCtrl.coffee
Last active April 8, 2018 01:47 — forked from elado/AngularBaseCtrl.coffee
Angular.js CoffeeScript Controller Base Class
# dependency - Function.prototype.bind or underscore/lodash
app = angular.module 'someApp'
class @BaseCtrl
@register: (app, name) ->
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1]
app.controller name, @
@inject: (args...) ->
Make sure libxml2-devel, libxslt-devel and libiconv-devel are installed:
$ gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib --with-xslt-dir=/usr/include/libxslt --with-iconv-include=/usr/include --with-iconv-lib=/usr/lib