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:2fabb09c397e25d46930
Last active August 29, 2015 14:17
Sort array of objects based on given order of ids (ruby)
my_hash = {}

@objects.each { |obj| my_hash[obj.id] = obj }

my_array.collect{ |id| my_hash[id] }
@vdw
vdw / gist:eed289bb13de59160324
Last active August 29, 2015 14:17
Convert integer to scientific notation (javascript)
i = 1000
i.toExponential();

// 1e+3
@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