Skip to content

Instantly share code, notes, and snippets.

View scicco's full-sized avatar

scicco

View GitHub Profile
@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 / 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 / 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
module Devise
module Models
module TwitterOauth
extend Devise::Twitter
end
end
end
@scicco
scicco / delete_old_kernel.sh
Created September 20, 2012 08:45
remove oldest kernel version from /boot
#modified script version from the.helped comment posted here: http://tuxtweaks.com/2009/12/remove-old-kernels-in-ubuntu/
#!/bin/bash
echo 'You are currently running: '`uname -r`
echo 'The following kernel images exist in /boot:'
ls /boot|grep vmlinuz|cut -d'-' -f2,3
nKerns=`ls /boot|grep vmlinuz|wc -l`
if [ $nKerns -gt 1 ]
then
# Ok to remove the oldest ONE
@scicco
scicco / user_replacement
Created September 24, 2012 13:54
Replace all files owned by a non existing user on system
#!/bin/bash
for file in `find /home/foo/ -nouser`
do
echo $file
chown <NEW_OWNER>:<NEW_GROUP> $file
done
echo 'complete'
@scicco
scicco / pull_from_all.sh
Created October 11, 2012 18:21
git pull in all sub folder from current path
#!/bin/bash
here=$PWD
echo "**********************************************"
for folder in ./*
do
echo "pulling from $folder"
echo "**********************************************"
cd "$here" && cd "$folder" && git pull origin
echo "**********************************************"
done
@scicco
scicco / time_format.rb
Created October 19, 2012 16:36
time format
#!/usr/bin/env ruby
require 'rubygems'
require 'active_support/core_ext'
chars = (('a'..'z').to_a + ('A'..'Z').to_a)
time = Time.now.beginning_of_month
twelve_hours_from_now = 12.hours.from_now
end_of_next_month = 1.month.from_now.end_of_month
@scicco
scicco / allmembers.sh
Created November 23, 2012 13:04
List all users for each group with members command
#!/bin/bash
# Version: 0.1
# Description: This script has a dependancy with members package
# Tested only on Ubuntu
#
# todo:
# - test members package existance with which output
# - get rid of members dependancy
@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
}