Skip to content

Instantly share code, notes, and snippets.

/**
* jQuery UI Tabs Closable
* http://anohan.wordpress.com/jquery-ui-tabs-closable
*
* Copyright (c) 2010, Dirley Rodrigues
*
* Licensed under the New BSD License
* See: http://www.opensource.org/licenses/bsd-license.php
*
* Requires jQuery UI 1.4.2
@ravishi
ravishi / strpos.c
Created August 4, 2010 19:06
Uma função strpos feita do zero
/**
* Uma função strpos feita do zero.
*/
#include <stdio.h>
/**
* Procura a string b na string a.
*
* Retorna -1 se `b` não for encontrada em `a`, ou o índice da
* primeira ocorrência de b em a.
@ravishi
ravishi / readline.c
Created July 30, 2011 18:44
lê a entrada padrão até encontrar um newline
/**
* Versões:
* ... um bocado de versões bugadas ou incompletas
* 1. uma versão "funcional"
* 2. removidas as chamadas a fflush(stdin), que eram inúteis, como é explicado dado aqui [1]
*
* [1] http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1052863818&id=1043284351
*/
#include <stdio.h>
#include <stdlib.h>
@ravishi
ravishi / ubuntu-post-install.sh
Last active November 8, 2019 12:02
My post install script for Ubuntu
#!/bin/bash
# TODO
# - Automatically fix the "Unknown display" problem by editing grub defaults
# like described here: http://askubuntu.com/questions/398903/unknown-display-besides-laptop-built-in-display-old-question-but-with-no-answer
##
## Essential stuff
##
sudo apt-get install -y build-essential aria2 git mercurial subversion \
@ravishi
ravishi / ppa-adder.py
Last active October 10, 2015 19:37
Adds a PPA by using urllib to get it's key. Useful when you are behind a restrictive proxy (I think I created it because apt-add-repository was having some problems with a proxy configuration...)
#!/usr/bin/env python
from __future__ import unicode_literals
from __future__ import print_function
import contextlib
import subprocess
import tempfile
import urllib2
import os.path
import bs4
@ravishi
ravishi / xmonad.hs
Last active October 13, 2015 06:37
My XMonad configuration
-----------------------------------------------------------------------------
-- |
-- Copyright : (c) Dirley Rodrigues 2012
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : [email protected]
-- Stability : experimental
--
-- This module specifies my personal configuration values for xmonad
-- and declares it's main function.
@ravishi
ravishi / freya-lock-fix.sh
Created October 1, 2014 15:05
Fix "Lock screen" in ElementaryOS Freya
#!/bin/bash
# Stupidly simple script to fix the lockscreen option in ElementaryOS Freya.
# It listens to a dbus event and calls `dm-tool lock`.
#
# Run it in the background and lock your screen whenever you want!
#
# $ freya-lock-fix.sh &
# $ disown
# -> Lock screen
#
@ravishi
ravishi / random-wallpaper.sh
Last active August 29, 2015 14:11
Call this often to get a new wallpaper every day.
#!/bin/bash
#
# random-wallpaper.sh
# Call this often enough to get a new wallpaper every day.
# Where the wallpapers are located
WALLPAPERS=~/pictures/wallpapers/r-wallpapers
# Where the last change date will be saved
REGISTRY=~/.random-wallpaper
// C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\dota\cfg\autoexec.cfg
// enable console
con_enable "1"
// right click to deny creeps
dota_force_right_click_attack "1"
// disable auto attacks
dota_player_units_auto_attack "0"