Skip to content

Instantly share code, notes, and snippets.

View EdgarOrtegaRamirez's full-sized avatar
📝
​Learning!

Edgar Ortega EdgarOrtegaRamirez

📝
​Learning!
View GitHub Profile
@gigkokman
gigkokman / fixing-failed-building-psycopg2-mac
Last active September 20, 2019 19:19
Failed building wheel for psycopg2 <ld: library not found for -lssl> with pip
``` ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1```
Point LDFLAGS to OpenSSL's lib & include directories
```env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install -r environments/development.txt```
@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active November 26, 2025 15:46
Disable HTML form input autocomplete and autofill

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@rayrutjes
rayrutjes / detectcontenttype.go
Created December 12, 2015 13:36
golang detect content type of a file
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
// Only the first 512 bytes are used to sniff the content type.
buffer := make([]byte, 512)
_, err = file.Read(buffer)
if err != nil {
@wvengen
wvengen / README.md
Last active January 5, 2025 05:20
Ruby memory analysis over time

Finding a Ruby memory leak using a time analysis

When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.

There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the

@filmgirl
filmgirl / el-capitan-install-usb
Last active November 30, 2019 04:05
Create Bootable USB Drive for OS X El Capitan
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app --nointeraction
@romansklenar
romansklenar / db.rake
Created April 1, 2015 18:08
Useful rake task for maintain PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc 'Maintains database by running command as ANALYZE, VACUUM and REINDEX'
task maintain: :environment do
verbose = ENV['VERBOSE'].present?
connection = ActiveRecord::Base.connection
puts "Maintaining database #{connection.current_database} ..."
connection.execute("VACUUM FULL #{'VERBOSE' if verbose}")
require 'securerandom'
require 'set'
tokens = Set.new
i = ENV['I'].to_i
length = ENV['KEY_LENGTH'].to_i
i.times do |i|
@waj
waj / ecr-macros.cr
Created December 18, 2014 21:47
Crystal Layouts with ECR
macro embed_ecr(filename, io_name)
\{{ run("ecr/process", {{filename}}, {{io_name}}) }}
end
macro ecr_file(filename)
def to_s(__io__, section = nil)
embed_ecr {{filename}}, "__io__"
end
def to_s(__io__, &block)
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def index
render text: index_html
end
private
def index_html
# config/routes.rb
resources :documents do
resources :versions, controller: "documents/versions" do
post :restore, on: :member
end
resource :lock, controller: "documents/locks"
end