Skip to content

Instantly share code, notes, and snippets.

View bichotll's full-sized avatar
😶
Doing stuff..

Jaume Tarradas Llort bichotll

😶
Doing stuff..
View GitHub Profile

Helpful stuff

check current network configuration

cat /etc/resolv.conf

start web server

sudo python3 -m http.server 80

check current ip

ip a

@bichotll
bichotll / __dirname.js
Created September 22, 2021 08:02
__dirname and __filename in ESM node
import { URL } from 'url'; // in Browser, the URL in native accessible on window
const __filename = new URL('', import.meta.url).pathname;
// Will contain trailing slash
const __dirname = new URL('.', import.meta.url).pathname;
class SessionToken {
}
class IDP {
static token
}
SELECT client.id, client.name, count(user.clientId) as total_users
from client
left join user
on (client.id = user.clientId)
group by
client.id
having total_users > 2
import React, { useState, useEffect } from "react";
type MousePositionType = {
x: number;
y: number;
};
type WindowSizeType = {
height: number;
width: number;
@bichotll
bichotll / zoomCalc.js
Created November 9, 2018 14:06
zoom calculation from lat, long and km scuare
function calcLong(lat, long, distance) {
var earth = 6378.137, //radius of the earth in kilometer
pi = Math.PI,
cos = Math.cos,
m = (1 / ((2 * pi / 360) * earth)) / 1000; //1 meter in degree
return long + (distance * m) / cos(lat * (pi / 180));
}
function calcLat(lat, long, distance) {
@bichotll
bichotll / pull-request.md
Last active October 9, 2018 10:00
How to work properly with Git

How to work nicely and sound with Git (Gitlab/Github):

1 - Let's get our local updated before everything git fetch --all

2 - Now we start a new branch (from master!) git checkout origin/master (or git checkout upstream/master or similar depending on your setup) and git checkout -b feature-a

@bichotll
bichotll / gist:5688fcaca061a9f17b8798ffe8d009f9
Created September 11, 2018 15:29
start ssh agent - linux
eval `ssh-agent -s`
@bichotll
bichotll / gist:5ba19929cddab16a3d16fd1a9240be1b
Created August 8, 2018 11:24
update all git subfolders
ls | xargs -I{} git -C {} pull
@bichotll
bichotll / update-all-git-repos.sh
Created April 3, 2018 14:47
update all git repos in a directory
ls | xargs -I{} git -C {} pull