Skip to content

Instantly share code, notes, and snippets.

View lalo's full-sized avatar

Eduardo Salinas lalo

View GitHub Profile
@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 %>
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@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.

@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:

@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
@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)
@willurd
willurd / web-servers.md
Last active May 6, 2024 09:12
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
@denji
denji / nginx-tuning.md
Last active May 3, 2024 03:57
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@hanleybrand
hanleybrand / Mac imposm install.md
Last active January 13, 2021 20:39
Install imposm on a mac with all dependencies in a vm, with postgress.app for postgis

Installing imposm

So, according to the imposm docs:

Imposm runs with Python 2.5, 2.6 and 2.7 and is tested on Linux and Mac OS X. Other dependencies are:

psycopg2: PostgreSQL adapter for Python

Tokyo Cabinet: File-based key-value database for the internal cache

@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results