This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
# create a path to the file "C:\Ruby200-x64\cacert.pem" | |
cacert_file = File.join(%w{c: Ruby200-x64 cacert.pem}) | |
Net::HTTP.start("curl.haxx.se") do |http| | |
resp = http.get("/ca/cacert.pem") | |
if resp.code == "200" | |
open(cacert_file, "wb") { |file| file.write(resp.body) } | |
puts "\n\nA bundle of certificate authorities has been installed to" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install build-essential checkinstall && sudo apt-get build-dep imagemagick -y | |
wget http://www.imagemagick.org/download/ImageMagick-6.9.0-0.tar.gz | |
tar xzvf ImageMagick-6.9.0-0.tar.gz | |
cd ImageMagick-6.9.0-0/ | |
./configure --prefix=/opt/imagemagick-6.9 && make | |
sudo checkinstall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Visual Studio 2010 (VS10): SET VS90COMNTOOLS=%VS100COMNTOOLS% | |
Visual Studio 2012 (VS11): SET VS90COMNTOOLS=%VS110COMNTOOLS% | |
Visual Studio 2013 (VS12): SET VS90COMNTOOLS=%VS120COMNTOOLS% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys' | |
# ssh -fNg -L 3307:127.0.0.1:3306 b@B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script flashes the ThinkPad light when there is hard drive activity. | |
// Run this command to compile it: | |
// g++ -Wall -Wextra -O2 -o hdd_led hdd_led.cc | |
// Then run as root. | |
// | |
// Script by Dan Stahlke, [email protected]. BSD license. No warranty. | |
#include <string> | |
#include <fstream> | |
#include <iostream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo rm /var/lib/mongodb/mongod.lock | |
sudo -u mongodb mongod -f /etc/mongod.conf --repair |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT n.nspname AS schema, | |
pg_catalog.format_type ( t.oid, NULL ) AS name, | |
t.typname AS internal_name, | |
CASE | |
WHEN t.typrelid != 0 | |
THEN CAST ( 'tuple' AS pg_catalog.text ) | |
WHEN t.typlen < 0 | |
THEN CAST ( 'var' AS pg_catalog.text ) | |
ELSE CAST ( t.typlen AS pg_catalog.text ) | |
END AS size, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#make sure slavko is added to sudoers group | |
# sudo usermod -aG sudo <username> | |
# Allow members of group sudo to execute any command without asking password | |
#%sudo ALL=(ALL:ALL) ALL | |
%sudo ALL=(ALL) NOPASSWD:ALL | |
#allow specific user to do so without password, where slavko is the username | |
slavko ALL=(ALL) NOPASSWD: ALL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ss -tln | | |
awk 'NR > 1{gsub(/.*:/,"",$4); print $4}' | | |
sort -un | | |
awk -v n=3000 '$0 < n {next}; $0 == n {n++; next}; {exit}; END {print n} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done |