Skip to content

Instantly share code, notes, and snippets.

View JannVazTor's full-sized avatar

Juan Vazquez JannVazTor

  • Hermosillo, Sonora.
View GitHub Profile
@JannVazTor
JannVazTor / git-branches-by-commit-date.sh
Created July 8, 2022 17:35 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@JannVazTor
JannVazTor / how-to-copy-aws-rds-to-local.md
Created November 24, 2018 17:44 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@JannVazTor
JannVazTor / Setting_upa_new_repo.md
Created November 2, 2018 17:33 — forked from alexpchin/Setting_upa_new_repo.md
Create a new repository on the command line

Setting up a new Git Repo

##Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"

git remote add origin git@github.com:alexpchin/.git

function wordLadder(beginWord, endWord, wordList) {
debugger;
var availableLetters = getUniqueLettersFromDictionary(wordList);
var wordFound = [];
var wordChanges = 0;
for (var i = 0; i < beginWord.length; i += 1) {
var currArrayWord = beginWord.split('');
function getTheLongestSubstring(word) {
var longestSubstring = 0;
for (var i = 0; i < word.length; i += 1) {
for (var j = i + 1; j < word.length + 1; j += 1) {
var substring = word.slice(i, j);
var substringWithUniqueLetters = eraseDuplicatedLetters(substring);
longestSubstring = substringWithUniqueLetters.length > longestSubstring ? substring.length : longestSubstring;
}
}
return longestSubstring;
function reverse_sentence(sentence){
return sentence.split(' ').reverse().toString().split(',').join(' ');
}
var sentence = 'the sky is blue';
document.write(reverse_sentence(sentence));