Skip to content

Instantly share code, notes, and snippets.

View Soft's full-sized avatar

Samuel Laurén Soft

View GitHub Profile
@Soft
Soft / gist:333269
Created March 15, 2010 20:13
My netbooks old Xmonad config
import XMonad
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Util.Run(spawnPipe)
import XMonad.Actions.CycleWS
import XMonad.Layout.Circle
import XMonad.Layout.MagicFocus
import XMonad.Layout.Tabbed
import XMonad.Prompt
import XMonad.Prompt.Ssh
@Soft
Soft / .vimrc
Created April 8, 2010 08:23
Some old .vimrc
set nocompatible
if has("gui_win32")
source $VIMRUNTIME/mswin.vim
behave mswin
endif
syntax on
set t_Co=256
@Soft
Soft / .vimrc
Created April 8, 2010 08:25
My .vimrc file
" Soft's .vimrc
" Useful plugins: indent-object, NERD_tree, NERD_commenter, delimitMate,
" snipMate, surround, Command-T, EasyMotion
" Nice colorschemes: Herald, Neverland, Mustang, Molokai
set nocompatible
if has("gui_win32")
source $VIMRUNTIME/mswin.vim
behave mswin
from install import *
packages= [
Package(name="Vim", posix=[
SymlinkTask("./.vimrc", "~/.vimrc")
])
]
install(packages)
// ==UserScript==
// @name Google shortcuts
// @include http://www.google.*/search*
// @include https://encrypted.google.com/search*
// @description Adds useful shortcuts to Google search results page
// ==/UserScript==
(function(){
var results = document.querySelectorAll("#ires>ol>li.g.w0");
var activated = false;
// ==UserScript==
// @name Reddit mobile redirect
// @include http://m.reddit.com/*
// @description Redirects m.reddit.com addresses to the main site
// ==/UserScript==
window.location = window.location.href.replace(/^http:\/\/m\.(.+)/, "http://www.$1");
// ==UserScript==
// @name Secure Wikipedia
// @include http://*/*
// @include https://*/*
// @description Changes links to Wikipedia articles to point to secure version
// ==/UserScript==
(function(){
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
// ==UserScript==
// @name Youtube comment remover
// @include http://www.youtube.com/watch*
// ==/UserScript==
(function() {
var comments = document.getElementById("watch-discussion");
comments.parentElement.removeChild(comments);
}())
// ==UserScript==
// @name Facebook Me gusta
// @include http://*.facebook.com/*
// @description Changes Like links to more appropriate "Me gusta"
// ==/UserScript==
Array.prototype.slice.call(document.querySelectorAll("button.like_link")).forEach(function (elem) {
elem.querySelector(".default_message").innerText = "Me gusta";
elem.querySelector(".saving_message").innerText = "No me gusta";
});
@Soft
Soft / time_to_seconds.c
Created August 17, 2010 13:05
Time to seconds
#include <stdlib.h>
#include <stdio.h>
// 1h 26m 15s -> 5175
unsigned int time_to_seconds(const char *str) {
const char *current = str;
unsigned int seconds = 0, number = 0;
while (*current) {
switch (*current) {
case 'h':