Skip to content

Instantly share code, notes, and snippets.

View brenogcota's full-sized avatar
🎧
coding

Breno Cota brenogcota

🎧
coding
View GitHub Profile
@brenogcota
brenogcota / branch-name-terminal.sh
Last active March 18, 2022 14:43
add git branch name like oh-my-zsh
## https://askubuntu.com/questions/730754/how-do-i-show-the-git-branch-with-colours-in-bash-prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\] $(parse_git_branch)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
fi
@brenogcota
brenogcota / interfaces.ts
Created January 10, 2022 16:38
interfaces
/* Autocomplete */
interface ISearchAutocomplete{
queries: Array<IQueries>
products: Array<IProducts>
}
interface IProducts{
id: string
name: string
price: number
@brenogcota
brenogcota / constants.ts
Created January 10, 2022 16:31
constants
export const baseURL = 'https://api.linximpulse.com';
/**
* REQUIRED
* apiKey
* secretkey
* @param name - Page Name
* @param source - App, Desktop, Mobile..
* @param dummy - DevMode?
* @example &name=home&source=desktop&deviceId=123&dummy=true&homologation=true&showOnlyAvailable=true
@brenogcota
brenogcota / helpers.ts
Last active January 10, 2022 16:51
Linx helpers
/** GET KEYS REGISTERED IN THE PANEL */
const getAppConfig = async (app: string) => {
try{
return (await axios({
url: `/_v/${app}`,
headers:{
'Content-Type': 'application/json',
Accept: 'application/json',
}
})).data;
@brenogcota
brenogcota / gist:8d3d82afbffb841935231adb17f5a87f
Created July 5, 2021 18:14
Disable | Enable Right Click
// disable
window.addEventListener('contextmenu', function (e) {
e.preventDefault();
}, false);
// enable
document.addEventListener('contextmenu', function (e) {
e.stopPropagation();
}, true);
@brenogcota
brenogcota / postgres.md
Last active November 13, 2021 14:32
basic psql commands

sudo -u user psql database

connect database

\c database

show seq schemas

\d

show schemas

\dt

Basics

save and quit

:wq or :x

quit

:q

force quit

:q!

back file

ctrl + o

open new window

ctrl + b c

exit to window

ctrl +b &

exit to pane

ctrl + b x

split panel horizontally

@brenogcota
brenogcota / downloadVimeo.js
Last active June 25, 2021 21:57
get url from vimeo iframe
// get url
let url = document.querySelector('body > script').text.split('\"url\":\"')[10].split('.mp4')[0] + '.mp4';
// open in new tab
window.open(url);
// ** Copy link and run in your terminal
wget -c 'your-link'
@brenogcota
brenogcota / getVideo.js
Created June 9, 2021 21:49
Download Pirple Courses - Wistia CDN
// step one:
let link = JSON.parse(document.querySelector('.w-json-ld').textContent)["@id"];
console.log('link: ', link)
window.open(link, '_target=blank');
// step two:
let link = document.querySelectorAll('script')[4].getInnerHTML().split('https://')[1].split('.bin')[0];
window.location.href = 'https://'+link+'.mp4';
// step three: