Skip to content

Instantly share code, notes, and snippets.

View scicco's full-sized avatar

scicco

View GitHub Profile
#!/bin/bash
/etc/init.d/nginx stop
certbot renew --dry-run
certbot renew
cd <THE_FOLDER_WITH_CERTIFICATES>
openssl rsa -in privkey.pem -out privkey-rsa.pem
/etc/init.d/nginx configtest
/etc/init.d/nginx start
/etc/init.d/nginx status
@scicco
scicco / secure_mariadb.yml
Created April 6, 2017 08:17
secure mariadb ansible tasks
---
#taken from here: https://github.com/68b32/ansible-role-mariadb/blob/7d01b08146c185064eb5c9d1b65b0f07c0e5eaee/tasks/mysql_secure_installation.yml
#
# Set root password
# UPDATE mysql.user SET Password=PASSWORD('mysecret') WHERE User='root';
# FLUSH PRIVILEGES;
- name: Set root user password
# If .my.cnf already exists, this will cause an mysql-root-password update.
mysql_user:
@scicco
scicco / disable-ipv6.yml
Last active April 3, 2017 15:01 — forked from tekei/disable-ipv6.yml
ansible : (ubuntu) disable IPv6
---
- name: Remove ipv6 hosts entry
replace:
dest: /etc/hosts
regexp: '^.*::\d\t.+|.*IPv6.*$'
#backup: yes
become: yes
# TODO FIND A WAY TO ELIMINATE EMPTY ROWS INSIDE /etc/hosts file
- name: Find ipv6 kernel parameter
shell: sysctl --all | egrep '^net.ipv6\..*disable' | awk '{print $1}'
@scicco
scicco / 10_min_expiration_for_sidekiq_status_items.rb
Last active February 27, 2017 14:06
10 minutes expiration for sidekiq_status items
#USE THIS INSIDE RAILS CONSOLE
cursor = 0
items = []
while(cursor != -1)
result = $redis.scan(cursor, match: "sidekiq:sidekiq:status*")
cursor = result[0].to_i
items += result[1]
puts cursor
if cursor == 0
cursor = -1
@scicco
scicco / stack_level_too_deep_debug.rb
Last active December 11, 2015 13:34
debug stack level too deep error in ruby
# found here:
# http://stackoverflow.com/a/28680027/1488217
set_trace_func proc {
|event, file, line, id, binding, classname|
if event == "call" && caller_locations.length > 500
fail "stack level too deep"
end
}
@scicco
scicco / patch_vmware_tools.sh
Created May 8, 2015 13:09
patch for vmware tool for ubuntu shared folder problem
#!/bin/sh -x
#
# found here: http://askubuntu.com/a/592127
#
cd /usr/lib/vmware-tools/modules/source
tar xf vmhgfs.tar
grep -q d_u.d_alias vmhgfs-only/inode.c && echo "already patched" && exit 0
sed -i -e s/d_alias/d_u.d_alias/ vmhgfs-only/inode.c
cp -p vmhgfs.tar vmhgfs.tar.orig
tar cf vmhgfs.tar vmhgfs-only
@scicco
scicco / cloudera_lzo_fix
Last active June 9, 2016 15:45
fixing Compression algorithm 'lzo' previously failed test.
cd /etc/yum.repos.d/
wget http://archive.cloudera.com/gplextras5/redhat/6/x86_64/gplextras/cloudera-gplextras5.repo
yum check-update
yum install -y hadoop-lzo
dd if=/dev/random of=/tmp/test.bin bs=1000k count=10
su - hdfs
hbase org.apache.hadoop.hbase.util.CompressionTest /tmp/test.bin lzo
echo "remember to restart all services on the node to take effect"
@scicco
scicco / conky.conf
Created February 21, 2014 09:29
Conky configuration
background no
font Sans:size=8
#xftfont Sans:size=10
use_xft yes
xftalpha 0.9
update_interval 3.0
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
@scicco
scicco / lang_code_export
Created February 4, 2014 22:31
get lang code from unix
require 'fileutils'
counter = 1
if File.exists?('/usr/share/i18n/SUPPORTED')
FileUtils.copy_file('/usr/share/i18n/SUPPORTED','/tmp/lang_list.txt') unless File.exists?('/tmp/lang_list.txt')
file = File.open("/tmp/lang_list.txt", "r")
file_export = File.new("/tmp/lang_export.txt", "w+")
lang_set = Hash.new
output_list = ""
while (line = file.gets)
puts "#{counter}: #{line}"
@scicco
scicco / geo_world_map_migration
Last active May 17, 2018 10:26
Rails migration for GeoWorldMap db into postgresql db
class CreatePlaces < ActiveRecord::Migration
# Rails migration for GeoWorldMap db into postgresql db
#(inspired by http://blog.inspired.no/populate-your-database-with-free-world-cities-countries-regions-in-2-minutes-using-a-rails-migration-273/ post)
#extract files from GeoWorldMap.zip archive from here
# http://www.geobytes.com/GeoWorldMap.zip
#
#and place them into #{Rails.root}/db/migrate/
##the archive has 'cities.txt' file, rename it 'Cities.txt'
#mv cities.txt Cities.txt