Skip to content

Instantly share code, notes, and snippets.

@caniszczyk
caniszczyk / clone-all-twitter-github-repos.sh
Created October 9, 2012 04:25
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@0xGGGGG
0xGGGGG / pgsql_workflow.sh
Last active January 21, 2016 13:28
postgres install and develop applications on MAC OSX with rails
# first install pgsql with home brew
brew install postgresql
# at this point, you need to be sure you have /usr/local/bin before /usr/bin on your $PATH
# to see, run:
brew doctor
# if doctor does not complain about this issue you can pass this step.
# prepend /usr/local/bin to your PATH in your ~/.bash_profile
@willurd
willurd / web-servers.md
Last active July 17, 2026 18:54
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
@lulalala
lulalala / banner.rb
Last active January 14, 2019 12:58 — forked from matheusvetor/banner.rb
Carrierwave image model validation on image dimensions/height/width.
class Banner < ActiveRecord::Base
attr_accessor :image_width, :image_height
mount_uploader :image, ImageUploader
validate :check_dimensions, :on => :create
def check_dimensions
if !image_cache.nil? && (image.width < 300 || image.height < 300)
errors.add :image, "Dimension too small."
end
end
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active June 18, 2026 17:53
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@rxaviers
rxaviers / gist:7360908
Last active July 20, 2026 04:00
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
(void) argc;
(void) argv;
//stores the last two terms, and the new sum
int terms[] = {1, 2, 3};
//stores indeces used to access the above array,
#! /usr/bin/env python3
from functools import lru_cache
from itertools import count, takewhile
numbers = count(1)
MAX = 4000000
@lru_cache(maxsize=None)
def fib(n) :
@MohamedAlaa
MohamedAlaa / problem_2.rb
Last active June 22, 2026 06:37
Egyptian Geeks - Project Euler Problem 2
#! /usr/bin/env ruby
first = 0
second = 1
i = 0
sum = 0
limit = 4000000
while i <= limit
i = first + second
@l0gicpath
l0gicpath / problem_2.erl
Last active August 29, 2015 13:55
Project Euler Problem #2
-module(problem_2).
-export([solve/1]).
-define(LIMIT, 4000000).
%% Normalizing the start value, need to start with an odd value and enter tail recursion
solve(Start) when Start rem 2 == 0, Start > 0 -> solve(Start - 1, Start, 0);
solve(Start) -> solve(Start, Start + 1, 0).
%% guard against the limit and drop out of recursion if we hit it
solve(Prev, Next, Sum) when Prev >= ?LIMIT; Next >= ?LIMIT -> Sum;
%% Sum even values