Skip to content

Instantly share code, notes, and snippets.

View scicco's full-sized avatar

scicco

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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:
#!/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
cat log/capistrano.log | egrep "^.+Command:\s(.+)$" | cut -d : -f 2 > log/capistrano_deploy_commands.log
@scicco
scicco / tcp_proxy.sh
Created February 20, 2018 14:53
tcp proxy using netcat
#!/bin/sh -e
# found here: https://notes.tweakblogs.net/blog/7955/using-netcat-to-build-a-simple-tcp-proxy-in-linux.html
if [ $# != 3 ]
then
echo "usage: $0 <src-port> <dst-host> <dst-port>"
exit 0
fi
@scicco
scicco / using_alias_from_ssh_minus_c
Created February 20, 2018 14:55
using alias when launching command from ssh -c
#found here: https://stackoverflow.com/a/22540192/1488217
# comment out the original line
# [ -z "$PS1" ] && return
if [ -z "$PS1" ]; then
shopt -s expand_aliases
# alias ls='ls --color=always'
# return
fi