Skip to content

Instantly share code, notes, and snippets.

View reinaldorauch's full-sized avatar
🤙

Reinaldo Antonio Camargo Rauch reinaldorauch

🤙
View GitHub Profile
@reinaldorauch
reinaldorauch / class.js
Last active September 30, 2022 01:23
javascript classes versus functions
class Klass {
private _privProperty = 10;
printHelloTenTimes() {
for (let i = 0; i < this._privProperty; i++) {
console.log('Hello');
}
}
}
function converteABNT(nomeCompleto) {
const [sobrenome, ...restoNome] = nomeCompleto.split(' ').reverse();
const [primeiroNome, ...restoNome2] = restoNome.reverse();
return [sobrenome.toUpperCase(), [primeiroNome, ...restoNome2.map(n => n[0] + '.')].join(' ')].join(', ');
}
// converteABNT('Reinaldo Antonio Camargo Rauch') === 'RAUCH, Reinaldo A. C.'
@reinaldorauch
reinaldorauch / start_ssh_agent_bashrc.bash
Created February 28, 2020 15:11
Start ssh-agent when you open a bash shell, not written by me but don't remember where I found it
# ssh-agent
if [ -f ~/.ssh/agent.env ] ; then
. ~/.ssh/agent.env > /dev/null
if ! kill -0 $SSH_AGENT_PID > /dev/null 2>&1; then
echo "Stale agent file found. Spawning new agent… "
eval `ssh-agent | tee ~/.ssh/agent.env`
ssh-add
fi
else
echo "Starting ssh-agent"
@reinaldorauch
reinaldorauch / output.log - repo sync
Last active December 21, 2019 10:37
.repo/local_manifests/
reinaldo@reinaldo-VirtualBox:~/android/lineage$ repo sync -l --fetch-submodules -q
Checking out projects: 5% (30/583) LineageOS/android_device_motorola_msm8916-commonerror: Cannot checkout LineageOS/android_external_aac: GitError: LineageOS/android_external_aac rev-list ('^14c0a419d4cbeb93261f6efb1b84c8efa7cb0129', 'HEAD', '--'): fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File "/home/reinaldo/android/lineage/.repo/repo/main.py", line 530, in <module>
_Main(sys.argv[1:])
File "/home/reinaldo/android/lineage/.repo/repo/main.py", line 505, in _Main
result = run()
File "/home/reinaldo/android/lineage/.repo/repo/main.py", line 498, in <lambda>
run = lambda: repo._Run(name, gopts, argv) or 0

Keybase proof

I hereby claim:

  • I am reinaldorauch on github.
  • I am reinaldorauch (https://keybase.io/reinaldorauch) on keybase.
  • I have a public key ASCmW9d6MpR7JuaQpwyYqB8M40uo7TNjD9UWB9_r9iAi1Ao

To claim this, I am signing this object:

function timeout(ms) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(), ms);
});
}
// Aí vc adiciona na corrente de promises na função de insersão do banco:
function bulkInsert(conn, data) {
const sql = 'INSERT INTO table (fielda, fieldb, fieldc) VALUES ?';
return mysqlQuery(sql, data.map(mapObjectIntoArray))
const Promise = require('bluebird'); // usado para rodar o map em sequência para não sobrecarregar o db
/**
* Converte a chamada da conexão para realizar query para usar promise
*/
function mysqlQuery(conn, sql, params) {
return new Promise((resolve, reject) => {
conn.query(sql, params, (err, result) => {
if (err) return reject(err);
resolve(result);
Mat invertImage(Mat image) {
Vec3b p;
for (int i = 0; i < image.rows; ++i)
{
for (int j = 0; j < image.cols; ++j)
{
p = image.at<Vec3b>(i, j);
image.at<Vec3b>(i, j)[0] = 255 - p[0];
image.at<Vec3b>(i, j)[1] = 255 - p[1];
<table style="border: 1px solid #000; border-collapse: collapse; padding: 10px;">
<thead>
<tr>
<th style="border: 1px solid #000;" colspan="2">Legenda</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border: 1px solid #000;"><span style="background-color: red; display: block; height: 50px; width: 50px;"></span></td>
<td style="border: 1px solid #000;">Terminal Central - Bairro</td>
export const login = async ({ commit }, creds) => {
try {
const user = await firebase.auth().signInWithEmailAndPassword(creds.email, creds.password)
commit(types.AUTH_SET_USER, user.uid);
return {
"success": true,
"data": user
}
} catch (error) {
return {