Skip to content

Instantly share code, notes, and snippets.

View bitkidd's full-sized avatar
🎯
Focusing

Chirill Ceban bitkidd

🎯
Focusing
View GitHub Profile
@bitkidd
bitkidd / aws-vesta-s3.md
Last active October 17, 2023 18:58
AWS S3 backup for Vesta

Before doing all this you have to create a bucket in your AWS console. Or just use AWS cli tool in order to create one.

  • Install pip (if not installed already):
$ curl -O https://bootstrap.pypa.io/get-pip.py
  • Install AWS cli tool:
$ sudo pip install awscli
@bitkidd
bitkidd / rails_passenger_setup.md
Last active February 15, 2016 19:10 — forked from ChuckJHardy/digital_ocean_setup.md
Ubuntu 14.04 x64 + RVM + NVM + Node.js + Rails 4 + Nginx + Passenger + PostgreSQL

Ubuntu 14.04 x64 + RVM + NVM + Node.js + Rails 4 + Nginx + Passenger + PostgreSQL

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

$ passwd
@bitkidd
bitkidd / deleting_tons_of_files_in_linux.md
Last active August 14, 2018 13:59
Deleting tons of files in Linux (Argument list too long)

If you’re trying to delete a very large number of files at one time (I deleted a directory with 485,000+ today), you will probably run into this error:

/bin/rm: Argument list too long.

The problem is that when you type something like “rm -rf ”, the “” is replaced with a list of every matching file, like “rm -rf file1 file2 file3 file4” and so on. There is a reletively small buffer of memory allocated to storing this list of arguments and if it is filled up, the shell will not execute the program. To get around this problem, a lot of people will use the find command to find every file and pass them one-by-one to the “rm” command like this:

find . -type f -exec rm -v {} \;

My problem is that I needed to delete 500,000 files and it was taking way too long.

@bitkidd
bitkidd / readonly_permissions.md
Last active December 29, 2015 04:36
readonly permissions for files and folders
find /var/www/html -type f -iname "*" -print0 | xargs -I {} -0 chmod 0444 {}
find /var/www/html -type d -iname "*" -print0 | xargs -I {} -0 chmod 0544 {}
@bitkidd
bitkidd / routes.rb
Created January 27, 2016 13:36 — forked from kryzhovnik/routes.rb
Интеграция Яндекс.Кассы с Rails
# config/routes.rb
YandexKassaIntegration::Application.routes.draw do
# ...
scope '/yandex_kassa' do
controller 'yandex_kassa', constraints: { subdomain: 'ssl' } do
post :check
post :aviso
get :success
get :fail
@bitkidd
bitkidd / app_backup.rb
Last active February 18, 2016 00:35
Rails Backup
# encoding: utf-8
##
# Backup Generated: app_backup
# Once configured, you can run the backup with the following command:
#
# $ backup perform -t app_backup [-c <path_to_configuration_file>]
#
# For more information about Backup's components, see the documentation at:
# http://backup.github.io/backup
@bitkidd
bitkidd / function.no-plugin-updates.php
Last active February 15, 2016 00:30
Discourage wordpress plugin updates
<?php
// Add this to your functions.php
// Discourage wordpress plugin updates
function no_plugin_updates($value) {
unset($value->response[ plugin_basename('pluginfolder/pluginfile.php') ]);
return $value;
}
add_filter('site_transient_update_plugins', 'no_plugin_updates');
@bitkidd
bitkidd / network-setup
Created February 15, 2016 18:11
Online.net VM/VPS network setup
auto eth0
iface eth0 inet static
address <your-vm-ip-address>
netmask <your-netmask(ex:255.255.255.255)>
broadcast <your-vm-ip-address>
post-up route add <your-server-getaway-ip(ex: usually ends with .1)> dev eth0
post-up route add default gw <your-server-getaway-ip(ex: usually ends with .1)>
post-down route del <your-server-getaway-ip(ex: usually ends with .1)> dev eth0
post-down route del default gw <your-server-getaway-ip(ex: usually ends with .1)>
dns-nameservers 8.8.8.8 8.8.4.4
@bitkidd
bitkidd / install-comodo-ssl-cert-for-nginx.rst
Created April 5, 2016 20:17 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@bitkidd
bitkidd / db_truncate_x.rb
Created April 25, 2016 22:38 — forked from kazukeyan/db_truncate_x.rb
add rake task "db:truncate:x" and "db:truncate:all"
namespace :db do
def detect_env
ENV['RAILS_ENV'] || 'development'
end
def truncate(table)
begin
case @config["adapter"]
when "mysql", "mysql2"
ActiveRecord::Base.connection.execute("TRUNCATE #{table}")
puts "Table #{table} truncated!"