Skip to content

Instantly share code, notes, and snippets.

@roopeshvaddepally
roopeshvaddepally / reverse_words.py
Created January 13, 2011 05:29
Reverse the words in a sentence seperated by spaces
a = "put in the required sentence"
# reverse splice the sentence split by space, then join with space
" ".join(a.split(" ")[::-1])
@roopeshvaddepally
roopeshvaddepally / remove_save_files.sh
Created January 14, 2011 07:35
Remove all files ending with '~'
find ~ -regex .*~$ -exec rm '{}' \;
(global-set-key "\C-h" 'delete-backward-char)
; bind original binding of help-command to a new shortcut, JIC
(global-set-key "\M-?" 'help-command)
# LICENCE: GPLv3
# download all the startdict dictionaries into proper directory on linux
# requirements:
# 1) lxml library for python
# 2) wget program on linux
# 3) /usr/share/stardict/dic folder must exist
# currently this works on linux only, but is a good starting point
# i am only interested in the `url`, and any other stardict dictionaries are of no interest to me
# there is no error handling what so ever, it's a quick and dirty solution.
#!/usr/bin/env python
# LICENCE: GPLv3
# temp files '.*~' from given directories or starting at home directory
# usage: rm_temp.py <arg1> <arg2> ... <argn>
# ouputs: log of which directory it is working in
import os
import sys
import logging
@roopeshvaddepally
roopeshvaddepally / line_column_nubers.el
Created January 16, 2011 05:11
enable line numbers in the sidebar and column numbers at the info line
(column-number-mode t) ; included with emacs from v22 or something
;; enable lines on the side of buffer
(require 'linum) ; included with emacs from v22 or something
(linum-mode t)
;; I want this feature available in all buffers. Just a convenience
(global-linux-mode t)
;; have a padding of one line between line numbers and the text
# works only on ubuntu, and probably with gnome desktop installed, it is similar to
# mac's `open` command.
# usage: op notes.txt # opens the txt file with it's default app
# usage: op . # open current directory in file explorer, default nautilus mostly
#
# Basically, this pushes the output from the opened app to not show up on terminal
function op {
eval gnome-open \"$@\" &> /dev/null;
}
@roopeshvaddepally
roopeshvaddepally / txt2ph.py
Created April 10, 2011 08:20
convert a phone number with alphabets in it to proper numbers
We couldn’t find that file to show.
@roopeshvaddepally
roopeshvaddepally / .irbrc
Created June 24, 2011 04:50 — forked from loginx/.irbrc
~/.irbrc config file to enable ActiveRecord logging to the rails console (if in rails console) and enable IRB autocompletion and autoindent.
require 'irb/completion'
require 'pp'
IRB.conf[:AUTO_INDENT]=true
if defined?(Rails) && !Rails.env.nil?
ActiveRecord::Base.logger = Logger.new(STDOUT)
end
@roopeshvaddepally
roopeshvaddepally / .autotest
Created July 19, 2011 05:22
autotest for ubuntu 11.04
#!/bin/ruby
# ~.autotest
# require 'autotest_notification'
# SPEAKING = false
# DOOM_EDITION = false
# BUUF = false
# PENDING = false
# STICKY = false
# SUCCESS_SOUND = ''
# FAILURE_SOUND = ''