Skip to content

Instantly share code, notes, and snippets.

View sergiosvieira's full-sized avatar

Sérgio Vieira sergiosvieira

  • Fortaleza
View GitHub Profile
dnf reinstall --allowerasing --skip-broken glib2-2.64.3-2.fc32.x86_64
docker-compose down
docker rm -fv $(docker ps -aq)
sudo lsof -i -P -n | grep 5432
@sergiosvieira
sergiosvieira / gist:924173b0967224a3fc603620dd3b86da
Created June 14, 2020 15:25
It shows specials char when using VIM
:set list
:set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:»
@sergiosvieira
sergiosvieira / delete_git_submodule.md
Created November 14, 2018 13:30 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
rm -rf 50 && mkdir 50 && for i in $(ls *.csv); do grep -e '^[0-9]' $i > tmp; awk 'NR%50==1' tmp > 50/$i; last=$(tail -n1 $i); echo $last; echo $last >> 50/$i; rm tmp; done
@sergiosvieira
sergiosvieira / gist:a0d865b7c1d453eba136cb7f1639310b
Created October 19, 2018 14:17
Pula n linhas para extrair valores de CAV
rm -rf 100 && mkdir 100 && for i in $(ls *.csv); do grep -e '^[0-9]' $i > tmp; awk 'NR%100==1' tmp > 100/$i; last=$(tail -n1 $i); echo $last; echo $last >> 100/$i; rm tmp; done
#include <iostream>
#include <map>
#include <vector>
#include <fstream>
#include <algorithm>
#include <stdexcept>
using Map = std::map<std::string, double>;
using Mtz = std::map<int, std::map<int, double>>;
using VectorOfString = std::vector<std::string>;
@sergiosvieira
sergiosvieira / 01.awk
Created April 17, 2018 11:49
Print only matched numbers
awk '{for(i=1;i<=NF;i++){tmp=match($i, /[0-9]{1,2}/);if(tmp){print substr($i, RSTART, RLENGTH);}}}' temp
#include <iostream>
#include <vector>
#include <iomanip>
#include <numeric>
int main(int argc, char** argv)
{
std::vector<std::string> months = {"JAN", "FEV", "MAR", "ABR", "MAI", "JUN", "JUL", "AGO", "SET", "OUT", "NOV", "DEZ", "ANUAL"};
std::vector<double> values = {201.5, 173.6, 164.3, 135, 120.9, 102, 108.5, 139.5, 165, 195.3, 198, 204.6};
double anual = std::accumulate(values.begin(), values.end(), 0);
http://mfitzp.io/article/add-git-branch-name-to-terminal-prompt-mac/