Skip to content

Instantly share code, notes, and snippets.

View BekBrace's full-sized avatar
💻
Star it before you Fork it!

Bek Brace BekBrace

💻
Star it before you Fork it!
View GitHub Profile
@BekBrace
BekBrace / settings.json
Last active November 27, 2021 10:38
JSX/HTML autocomplete in your React projects
// Add this code snippet to your settings.json file:
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
"emmet.triggerExpansionOnTab": true
@BekBrace
BekBrace / Mongodbcs.db
Last active April 20, 2022 14:38
MongoDB Cheat Sheet
// I used Datagrip in my crash course, but you can use the mongodb shell and you'll ge tthe same results.
//Friday, 18th June, 2021
//mongoDB basic commands and queries
//To show all databases
show dbs
//To switch(choose) a database
use sampleDatabase
@BekBrace
BekBrace / Readm.md
Last active April 20, 2022 14:43
Pub/sub with MongoDB and Node.js

Setup:

$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})

$ npm install mongodb

Register:

@BekBrace
BekBrace / cheatSheet.docker
Last active May 4, 2023 06:30
Docker Cheat Sheet
Container Management Commands
// docker create image [Create the container]
// docker run image [start the image]
// docker start container [start the container]
// docker stop container [graceful stop]
// docker kill container [kill container]
// docker restart container [stop + start]
// docker pause container [suspends container]
// docker unpause container [resume container]
@BekBrace
BekBrace / restart_docker_instance.md
Last active April 21, 2022 07:32
How to Do a Clean Restart of a Docker Instance

// Procedure

**Stop the container(s) using the following command:

docker-compose down

**Delete all containers using the following command:

docker rm -f $(docker ps -a -q)

@BekBrace
BekBrace / booking.sql
Last active January 28, 2023 18:35
MySQL Cheat Sheet
-- Simulate creating booking.com database
SHOW DATABASES;
CREATE DATABASE booking_company;
USE booking_company;
SELECT DATABASE ();
SHOW CREATE DATABASE booking_company;
-- create guests table
CREATE TABLE guests (
id INT NOT NULL AUTO_INCREMENT,
@BekBrace
BekBrace / fibonacci.py
Created May 30, 2022 06:13
Fibonacci sequence in Python
# Program to display the Fibonacci sequence up to n-th term
nterms = int(input("How many terms? "))
# first two terms
n1, n2 = 0, 1
count = 0
# check if the number of terms is valid
if nterms <= 0:
@BekBrace
BekBrace / fizzbuzz.py
Created May 30, 2022 06:14
FizzBuzz in Python
for fizzbuzz in range(51):
if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0:
print("fizzbuzz")
continue
elif fizzbuzz % 3 == 0:
print("fizz")
continue
elif fizzbuzz % 5 == 0:
print("buzz")
continue
@BekBrace
BekBrace / $profile.ps1
Last active December 31, 2022 08:55
this is profile file in documents for ohmyposh terminal customized theme
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
# S way
# oh-my-posh --init --shell pwsh --config ~/jblab_2021.omp.json | Invoke-Expression
# S theme
# oh-my-posh --init --shell pwsh --config C:\Users\amirb\AppData\Local\Programs\oh-my-posh\themes\ohmyposhv3-v2.json | Invoke-Expression
# OMP way
@BekBrace
BekBrace / fix.txt
Last active June 26, 2022 07:00
Fixing React Error : This is probably not a problem with npm. There is likely additional logging output above.
First, delete package-lock.json and node modules
Second, run the command : npm cache clean --force
Next, run the command : npm install
Finally, you should be able to run your react server : npm start