Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Alex Simenduev shamil

🎯
Focusing
View GitHub Profile
@shamil
shamil / gist:2165160
Created Mar 22, 2012 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.
View gist:2165160

Client-side SSL

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -out ca.key 2048
openssl req -new -x509 -days 365 -key ca.key -out ca.crt

Create the Client Key and CSR

@shamil
shamil / gist:3140541
Created Jul 19, 2012 — forked from iwinux/gist:1529093
config.assets.precompile
View gist:3140541
def compile_asset?(path)
# ignores any filename that begins with '_' (e.g. sass partials)
# all other css/js/sass/image files are processed
if File.basename(path) =~ /^[^_].*\.\w+$/
puts "Compiling: #{path}"
true
else
puts "Ignoring: #{path}"
false
end
@shamil
shamil / howto_deb_repackage.txt
Created Jul 19, 2012
Howto repackage deb packages
View howto_deb_repackage.txt
Use folowing steps to repackage dep package:
1: Extract deb package
# dpkg-deb -x <package.deb> <dir>
2: Extract control-information from a package
# dpkg-deb -e <package.deb> <dir/DEBIAN>
3. After completed to make changes to the package, repack the deb
# dpkg-deb -b <dir> <new-package.deb>
@shamil
shamil / snippet_show_grants.sh
Created Jul 19, 2012
mysql show grants snippet
View snippet_show_grants.sh
# Show all grants
mysql --skip-column-names -e "SELECT user, host FROM mysql.user" | sed 's/\t/"@"/g; s/^/SHOW GRANTS FOR "/g; s/$/";/g;' | mysql --skip-column-names
@shamil
shamil / iptables_redirect.sh
Last active Sep 13, 2018
how to redirect from one port to another using iptables
View iptables_redirect.sh
# how to redirect from one port to another using iptables
###
# install following package in order to preserve the iptables rules
sudo apt-get install iptables-persistent
# redirect from port 80 to port 8000
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8000
# redirect from one IP to other
@shamil
shamil / nagios_mod-gearman_ubuntu.md
Created Aug 21, 2012
how to install nagios3 with mod-gearman on Ubuntu
View nagios_mod-gearman_ubuntu.md

how to install nagios3 with mod-gearman on Ubuntu

configure apt to not install sugested and recommended packages

sudo tee /etc/apt/apt.conf.d/02recommends <<END
APT::Install-Recommends "0";
APT::Install-Suggests "0";
APT::AutoRemove::RecommendsImportant false; # optional
END
@shamil
shamil / gedit2subl.sh
Created Oct 15, 2012
Change all associations from gedit to another application
View gedit2subl.sh
#System wide associations:
sudo sed -i 's/gedit.desktop/yournew.desktop/g' /usr/share/applications/defaults.list
# Just your user's associations:
sed -i 's/gedit.desktop/yournew.desktop/g' ~/.local/share/applications/mimeapps.list
# If you're using the PPA for Sublime Text 2, there is already a .desktop file for it
# sitting in `/usr/share/applications/` so you can just run:
@shamil
shamil / gist:3944357
Created Oct 24, 2012 — forked from mneedham/gist:3803604
Script to get upstart out of a start/killed state (http://heh.fi/tmp/workaround-upstart-snafu)
View gist:3944357
#!/usr/bin/env ruby1.8
class Workaround
def initialize target_pid
@target_pid = target_pid
first_child
end
def first_child
@shamil
shamil / aug_redis_conf.sh
Created Oct 24, 2012
augeas how to load lenses (redis.conf example)
View aug_redis_conf.sh
$ augtool
> set /augeas/load/Spacevars/incl[last()+1] "/etc/redis/redis.conf"
> load
> print /files/etc/redis/redis.conf
@shamil
shamil / uuid.js
Created Nov 26, 2012 — forked from jcxplorer/uuid.js
UUID v4 generator in JavaScript (RFC4122 compliant)
View uuid.js
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-"
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}