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 / 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 / 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 / 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 / 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 / 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!"

Keybase proof

I hereby claim:

  • I am keeross on github.
  • I am keeross (https://keybase.io/keeross) on keybase.
  • I have a public key whose fingerprint is 7C5E A2EB 82EB C279 D15D 8822 3320 06B9 7A7C DBD0

To claim this, I am signing this object:

@bitkidd
bitkidd / gopath-dirs.md
Last active July 20, 2017 21:39
Manage multiple GOPATH dirs with ease

The solution is simple. Just include the following snippet in your ~/.bashrc (or ~/.bash_profile) and reload your shell environment with source ~/.bashrc. This snippet will create a shell function that will override the builtin command cd with a customized one that scans the entered directory, and every other above, for a file named .gopath.

cd () {
    builtin cd "$@"
    cdir=$PWD
    while [ "$cdir" != "/" ]; do
        if [ -e "$cdir/.gopath" ]; then
 export GOPATH=$cdir #or GOPATH=$GOPATH:$cdir if you want to keep original $GOPATH
@bitkidd
bitkidd / .gitlab-ci.yml
Created July 27, 2017 15:23 — forked from comilab/.gitlab-ci.yml
GitLab.com + GitLab-CI + Shared runners + gulp + rsyncで自動デプロイ
image: node:latest
cache:
paths:
- node_modules/
before_script:
- apt-get update -y
- apt-get install rsync openssh-client -y
- npm install