Skip to content

Instantly share code, notes, and snippets.

View aldodelgado's full-sized avatar
💭
Bring a spring upon her cable

Aldo Delgado aldodelgado

💭
Bring a spring upon her cable
View GitHub Profile
@aldodelgado
aldodelgado / namemash.py
Created February 4, 2021 08:40 — forked from superkojiman/namemash.py
Creating a user name list for brute force attacks.
#!/usr/bin/env python
import sys
import os.path
if __name__ == "__main__":
if len(sys.argv) != 2:
print("usage: {} names.txt".format((sys.argv[0])))
sys.exit(0)
if not os.path.exists(sys.argv[1]):
# XCode Command Line Tools
xcode-select --install
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo PATH=/usr/local/bin:/usr/local/sbin:$PATH >> ~/.bash_profile
source ~/.bash_profile
brew tap homebrew/versions
@aldodelgado
aldodelgado / heroku_pg_db_reset.md
Created February 21, 2020 15:36 — forked from zulhfreelancer/heroku_pg_db_reset.md
How to reset PG Database on Heroku?

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

heroku restart; heroku pg:reset DATABASE --confirm APP-NAME; heroku run rake db:migrate

@aldodelgado
aldodelgado / README
Created October 24, 2019 01:59 — forked from andreaslillebo/README
Rails - models organization - Keep code structure in models consistent
# Keep code struture in models consistent
# Inspired by http://rails-bestpractices.com/posts/75-keep-code-struture-in-models-consistent
# One example: (From top to bottom)
associations
scopes
class methods
validates
callbacks
instance methods
@aldodelgado
aldodelgado / update_hosts
Created May 28, 2019 01:27 — forked from kolpanic/update_hosts
Uses the MVPS hosts file to block unwanted parasites by redirecting them to `0.0.0.0`
#!/bin/bash
# Downloads the MVPS hosts file, and append it to the system hosts file
#
# If you want to make any manual persistent changes to the system hosts
# file, run this script first, then make sure that the change is backed up to
# /etc/hosts.orig.
if [ "$(whoami)" != "root" ]; then
echo "Sorry, this script must be run as root."
@aldodelgado
aldodelgado / mortgage_affordability_zillow_api.md
Created August 2, 2018 18:09 — forked from ryandhaase/mortgage_affordability_zillow_api.md
Mortgage Affordability Calculator - Built in Ruby on Rails

Mortgage Affordability Calculator - Built in Ruby on Rails

Functionality
  1. Send a GET request containing the following user inputs to Zillow's Mortgage Affordability API. Inputs as follows:
  • Annual Income, Monthly Payment, Down, Monthly Debts, Rate, Schedule, Term, Debt to Income, Income Tax, Property Tax, Hazard, PMI, HOA, ZIP
  1. A successful response from the GET request will contain the following attributes/information:
    • Affordability Amount, Monthly Principle and Interest, Monthly Property Tax, Monthly Hazard Insurance, Monthly PMI, Monthly HOA Dues, Total Monthly Payment, Total Payments, Total Interest Payments, Total Principal, Total Taxes Fees and Insurance, Monthly Income, Monthly Debts, Monthly Income Tax, Monthly Remaining Budget
Build:
@aldodelgado
aldodelgado / iconv.docker
Created July 18, 2018 16:44 — forked from tristanlins/iconv.docker
Docker PHP extension recipes
FROM php:5.6-cli
RUN apt-get update \
&& apt-get install -y \
libfreetype6-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install iconv \
&& apt-get remove -y \
libfreetype6-dev \
&& apt-get install -y \
@aldodelgado
aldodelgado / README.md
Created April 13, 2018 17:10 — forked from tristanm/README.md
Migrating a Rails project from MySQL to PostgreSQL

Migrating a Rails project from MySQL to PostgreSQL

This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.

No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!

I chose [pgloader][1] because it's extremely fast. YMMV.

  1. Replace mysql2 gem with pg in Gemfile.
  2. Update config/database.yml for PostgreSQL. I used [Rails' template][2] as a starting point.
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs

Install the required packages

apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev make git -y

Compile

cd /usr/src
git clone --recursive https://github.com/vysheng/tg.git