Skip to content

Instantly share code, notes, and snippets.

View vdw's full-sized avatar

Dimitris Krestos vdw

View GitHub Profile
@vdw
vdw / gist:09efee4f264bb2630345
Last active January 31, 2023 08:55
Kill tcp connection with tcpkill on CentOS

Install tcpkill
yum -y install dsniff --enablerepo=epel

View connections
netstat -tnpa | grep ESTABLISHED.*sshd.

Block with ip tables
iptables -A INPUT -s IP-ADDRESS -j DROP

Kill connection

@vdw
vdw / gist:f3c832df8ce271a036f2
Last active January 19, 2018 10:53
Ruby hash to dotted path

Convert a ruby hash to dotted path

def hash_to_dotted_path(hash, path = "")
  hash.each_with_object({}) do |(k, v), ret|
    key = path + k.to_s

    if v.is_a? Hash
      ret.merge! hash_to_dotted_path(v, key.to_s + ".")
 else
@vdw
vdw / gist:5093828
Last active December 19, 2016 22:36
Install RVM on Ubuntu from scratch

Install RVM on Ubuntu 12 from scratch

Clean up

1) Run the following commands to remove rvm:
rvm implode
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh
2) Run the sudo apt-get --purge remove ruby-rvm command to remove ruby.

Install RVM

@vdw
vdw / gist:5640164
Created May 23, 2013 23:04
Development Enviroment

Install MySQL server in Ubuntu

1) sudo apt-get install mysql-server

2) sudo apt-get install php5-mysql for php

3) sudo apt-get install libmysql-ruby for ruby

@vdw
vdw / gist:5630003
Last active December 17, 2015 15:09
Basic CSS beautification rules

Basic CSS beautification rules

1) Order attributes alphabetically (not rules)

@vdw
vdw / gist:5549622
Last active December 17, 2015 04:19
All about Sublime and its packages

Install Sublime Text 2 on Ubuntu

Add repository

sudo add-apt-repository ppa:webupd8team/sublime-text-2

Update

sudo apt-get update
@vdw
vdw / gist:5205268
Last active December 15, 2015 04:59
Sublime Text 2 basic user settings

Sublime Text 2 basic user settings

Preferences.sublime-settings

{
	"auto_complete": true,
	"auto_complete_commit_on_tab": false,
	"auto_complete_delay": 50,
	"auto_complete_selector": "source - comment",
	"auto_complete_size_limit": 4194304,
@vdw
vdw / gist:5146681
Last active December 14, 2015 20:49
Basic Git commands

Basic Git commands

git init Initiate git in an existing project.

git clone git@repository_ssh Clone a project (you do not have to create a folder).

git add . Add any new files under version control.

git commit -am 'This is a message.' Commit the changes.

@vdw
vdw / carrierwave.rb
Created December 8, 2015 10:05
Set a remote path for assets
CarrierWave.configure do |config|
config.asset_host = proc do |file|
'http://www.domain.com'
end
end
@vdw
vdw / gist:3748557
Last active October 10, 2015 20:48
Basic CSS shortner rules

Basic CSS shortner rules

1) Trim white spaces

2) Remove new lines (/n) ~> single line

3) Remove last semi-column (;)

4) Hexadecimal color:

  • #FFFFFF becomes #fff (color is case-insensitive)