Skip to content

Instantly share code, notes, and snippets.

View joaobispo2077's full-sized avatar
💭
Solving problems

João Bispo joaobispo2077

💭
Solving problems
View GitHub Profile
@jonasgroendahl
jonasgroendahl / useWebSockets.tsx
Created October 29, 2020 21:48
useWebSockets()
import {useEffect, useRef, useState} from 'react';
import io from 'socket.io-client';
type Props = {
userId: number;
enabled: boolean;
onConnected?: () => void;
};
type Message = {
@luizomf
luizomf / README.md
Last active April 2, 2024 15:16
VSCode settings.json - keybindings.json - recomendations - extensions.json. Just to backup (visual studio code)
@jjvillavicencio
jjvillavicencio / setup.sh
Last active May 5, 2024 12:53
Install Android SDK on Windows Bash (WSL)
cd /home/<user>/
sudo apt-get install unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d Android
rm sdk-tools-linux-4333796.zip
sudo apt-get install -y lib32z1 openjdk-8-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc
cd Android/tools/bin
@ThadeuLuz
ThadeuLuz / dddsBrasileiros.json
Last active April 5, 2024 00:32
Objeto JSON com Estados Brasileiros por DDD e lista de DDDs por Estados.
{
"estadoPorDdd": {
"11": "SP",
"12": "SP",
"13": "SP",
"14": "SP",
"15": "SP",
"16": "SP",
"17": "SP",
"18": "SP",
@cerebrl
cerebrl / 1-securing-express.md
Last active August 2, 2023 22:48
Securing ExpressJS

tl;dr

  1. Don't run as root.
  2. For sessions, set httpOnly (and secure to true if running over SSL) when setting cookies.
  3. Use the Helmet for secure headers: https://github.com/evilpacket/helmet
  4. Enable csrf for preventing Cross-Site Request Forgery: http://expressjs.com/api.html#csrf
  5. Don't use the deprecated bodyParser() and only use multipart explicitly. To avoid multiparts vulnerability to 'temp file' bloat, use the defer property and pipe() the multipart upload stream to the intended destination.
@TylerFisher
TylerFisher / hosting-on-github.md
Last active May 1, 2024 13:39
Basic steps for hosting on Github

Hey there, apparently people are still using this Gist from 2013! It's out of date! Consult the Github docs.

Steps for Hosting a Website on GitHub

  1. Create a GitHub account on github.com.
  2. Download either [GitHub for Mac][1] or [GitHub for Windows][2], depending on your operating system. Open the app and log in using the account you just created.
  3. (On Mac): After you login, click advanced and make sure that your name and email are correct. Then, click "Install Command Line Tools", just in case you want to start using the command line later in life.
  4. Create a new repository in your GitHub application. Name it your-username.github.io. The name is very important. Note the folder that GitHub is saving the repository to. Make sure the "Push to GitHub?" box is checked.
  5. Move your website's files into the folder that GitHub just created when you made the repository. IMPORTANT: Your homepage HTML file must be called "index.html", and it must exist in the top-level
@fogus
fogus / pacman.c
Created June 20, 2012 20:19 — forked from eduardodx/pacman.c
Pacman
#include <unistd.h> // lib para o delay => usleep()
#include <stdlib.h>
#include <time.h>
#include <ncurses.h>
#define H 25 // altura do mapa
#define W 42 // largura do mapa
#define UP 0
#define RIGHT 1
#define DOWN 2
#define LEFT 3