Skip to content

Instantly share code, notes, and snippets.

View byhbt's full-sized avatar

Thanh Huynh (Thành) byhbt

View GitHub Profile
@BenSampo
BenSampo / deploy.sh
Last active July 16, 2024 07:53
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
#Naval40
##How to Get Rich (without getting lucky)
Seek wealth, not money or status. Wealth is having assets that earn while you sleep. Money is how we transfer time and wealth. Status is your place in the social hierarchy.
Understand that ethical wealth creation is possible. If you secretly despise wealth, it will elude you.
Ignore people playing status games. They gain status by attacking people playing wealth creation games.
You're not going to get rich renting out your time. You must own equity - a piece of a business - to gain your financial freedom.

How to Get Rich (without getting lucky):

Seek wealth, not money or status. Wealth is having assets that earn while you sleep. Money is how we transfer time and wealth. Status is your place in the social hierarchy.

Understand that ethical wealth creation is possible. If you secretly despise wealth, it will elude you.

Ignore people playing status games. They gain status by attacking people playing wealth creation games.

You’re not going to get rich renting out your time. You must own equity - a piece of a business - to gain your financial freedom.

@jswny
jswny / Flexible Dockerized Phoenix Deployments.md
Last active July 3, 2023 05:25
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

"I've often seen this quote used to justify obviously bad code or code that, while its performance has not been measured, could probably be made faster quite easily, without increasing code size or compromising its readability.
In general, I do think early micro-optimizations may be a bad idea. However, macro-optimizations (things like choosing an O(log N) algorithm instead of O(N^2)) are often worthwhile and should be done early, since it may be wasteful to write a O(N^2) algorithm and then throw it away completely in favor of a O(log N) approach.
Note the words may be: if the O(N^2) algorithm is simple and easy to write, you can throw it away later without much guilt if it turns out to be too slow. But if both algorithms are similarly complex, or if the expected workload is so large that you already know you'll need the faster one, then optimizing early is a sound engineering decision that will reduce your total workload in the long run.
Thus, in general, I think the right approach is to find out what
# wget -i this_file
http://www.oreilly.com/programming/free/files/files/microservices-for-java-developers.pdf
http://www.oreilly.com/programming/free/files/modern-java-ee-design-patterns.pdf
http://www.oreilly.com/programming/free/files/object-oriented-vs-functional-programming.pdf
http://www.oreilly.com/programming/free/files/java-the-legend.pdf
http://www.oreilly.com/programming/free/files/functional-programming-python.pdf
http://www.oreilly.com/programming/free/files/reactive-microservices-architecture-orm.pdf
http://www.oreilly.com/programming/free/files/migrating-cloud-native-application-architectures.pdf
http://www.oreilly.com/programming/free/files/software-architecture-patterns.pdf
=======================
ONLINE RESOURCES:
=======================
SECTION 1 - OVERVIEW - COURSE INTRODUCTION
========================================
- understand the Magento architecture and modules
- efficiently and effectively customize and extend Magento
- enable the best upgrade path to new versions
@skluck
skluck / nasa-power-of-10.md
Last active January 16, 2020 10:54
The Power of Ten - Rules for Developing Safety Critical Code

The Power of Ten – Rules for Developing Safety Critical Code [[1]]

Gerard J. Holzmann
NASA/JPL Laboratory for Reliable Software
Pasadena, CA 91109

Most serious software development projects use coding guidelines. These guidelines are meant to state what the ground rules are for the software to be written: how it should be structured and which language features should and should not be used. Curiously, there is little consensus on what a good coding standard is. Among the many that have been

https://pablohaya.com/2013/10/12/diferencia-entre-scanf-gets-y-fgets/
https://raw.githubusercontent.com/google/styleguide/gh-pages/google-c-style.el
http://google.github.io/styleguide/
http://ieng9.ucsd.edu/~cs30x/indhill-cstyle.html
http://homepages.inf.ed.ac.uk/dts/pm/Papers/nasa-c-style.pdf
https://users.ece.cmu.edu/~eno/coding/CCodingStandard.html#gconstants
@pcrglennon
pcrglennon / validate_with_matcher.rb
Last active April 10, 2023 06:21 — forked from Bartuz/validate_with_matcher.rb
RSpec matcher for validates_with
# RSpec matcher for validates_with.
# https://gist.github.com/2032846
# Usage:
#
# describe User do
# it { should validate_with CustomValidator }
# end
#
# describe User do
# it do