Skip to content

Instantly share code, notes, and snippets.

View lalo's full-sized avatar

Eduardo Salinas lalo

View GitHub Profile
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@dmarx
dmarx / LinkFixerClone.py
Last active January 19, 2021 02:20
A simple LinkFixerBot clone developed as a demonstration for anyone who is curious how a simple reddit bot might be coded. To kill this code, spam "Ctrl+C" until it catches the exception.
import praw # simple interface to the reddit API, also handles rate limiting of requests
import re
from collections import deque
from time import sleep
USERNAME = "Your username here"
PASSWORD = "Your password here"
USERAGENT = "Your useragent string here. It should include your /u/username as a courtesy to reddit"
r = praw.Reddit(USERAGENT)
@kana
kana / realtime.diff
Created December 4, 2012 09:58
Realtime keystroke recording for Vim
--- src/main.c~ 2012-10-23 12:35:34.000000000 +0900
+++ src/main.c 2012-12-04 18:42:25.000000000 +0900
@@ -2315,6 +2315,7 @@
mch_errmsg("\"\n");
mch_exit(2);
}
+ setvbuf(scriptout, NULL, _IONBF, 0);
break;
#ifdef FEAT_GUI_W32
@kennethreitz
kennethreitz / pr.md
Created September 12, 2012 20:56 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@henrik
henrik / ocr.markdown
Created March 3, 2012 17:07
OCR on OS X with tesseract

Install ImageMagick for image conversion:

brew install imagemagick

Install tesseract for OCR:

brew install tesseract --all-languages

Or install without --all-languages and install them manually as needed.

@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@acorcutt
acorcutt / gist:1099813
Created July 22, 2011 16:41
Post array of text_field's in rails as array
<%-# items is an array on object e.g. object.items = [1,2,3], we want to display as list of fields, and post back as an array - note the backwards ][ which makes is do this! -%>
<% @object.items.each do |i| %>
<%=f.text_field "items][",:value=>i,:id=>"item-#{SecureRandom.uuid}" %>
<% end %>