Skip to content

Instantly share code, notes, and snippets.

View scicco's full-sized avatar

scicco

View GitHub Profile
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 / git.bashrc
Last active July 5, 2016 08:30
git.bashrc
# ~/.bashrc
# tab-completion for git subcommands
# (this is for git installed via MacPorts: `sudo port install git-core +svn`)
#source /usr/local/Cellar/git/1.7.6/etc/bash_completion.d/git-completion.bash
# git status with a dirty flag
function __git_status_flag {
git_status="$(git status 2> /dev/null)"
remote_pattern="^# Your branch is (.*) of"
@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
@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