Skip to content

Instantly share code, notes, and snippets.

View shamil's full-sized avatar
🎯
Focusing

Alex Simenduev shamil

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

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 July 19, 2012 03:20 — forked from iwinux/gist:1529093
config.assets.precompile
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 July 19, 2012 03:29
Howto repackage deb packages
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 July 19, 2012 03:52
mysql show grants snippet
# 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 November 27, 2023 09:34
how to redirect from one port to another using iptables
# 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 August 21, 2012 20:31
how to install nagios3 with mod-gearman on Ubuntu

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 October 15, 2012 14:33
Change all associations from gedit to another application
#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 October 24, 2012 06:24 — forked from mneedham/gist:3803604
Script to get upstart out of a start/killed state (http://heh.fi/tmp/workaround-upstart-snafu)
#!/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 October 24, 2012 15:09
augeas how to load lenses (redis.conf example)
$ augtool
> set /augeas/load/Spacevars/incl[last()+1] "/etc/redis/redis.conf"
> load
> print /files/etc/redis/redis.conf
@shamil
shamil / uuid.js
Created November 26, 2012 15:52 — forked from jcxplorer/uuid.js
UUID v4 generator in JavaScript (RFC4122 compliant)
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);
}