Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
bradtraversy / mern-server-setup.md
Last active May 3, 2024 00:35
Setup Ubuntu & Deploy MERN app

Linux Server Setup & MERN App Deployment

These are the steps to setup an Ubuntu server from scratch and deploy a MERN app with the PM2 process manager and Nginx. We are using Linode, but you could just as well use a different cloud provider or your own machine or VM.

Create an account at Linode

Click on Create Linode

Choose your server options (OS, region, etc)

SSH Keys

@aradalvand
aradalvand / DockerfileForSvelteKit.md
Last active May 7, 2024 16:44
Dockerfile and .dockerignore for SvelteKit:

*This Dockerfile is intended for SvelteKit applications that use adapter-node. So, the Dockerfile below assumes that you have already installed and configured the adapter.

Dockerfile:

FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json .
RUN npm ci
COPY . .
RUN npm run build
@sekcompsci
sekcompsci / Comparison Espressif ESP MCUs.md
Created June 18, 2021 03:56 — forked from fabianoriccardi/Comparison Espressif ESP MCUs.md
Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

A minimal table to compare the Espressif's MCU families.

ESP8266 ESP32 ESP32-S2 ESP32-S3 ESP32-C3 ESP32-C6
Announcement Date 2014, August 2016, September 2019, September 2020, December

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@rppowell-lasfs
rppowell-lasfs / youtube-like-dislike.js
Created January 4, 2018 20:20
javascript youtube likes/dislikes
javascript:(function(){
var buttons = document.querySelectorAll('#menu ytd-toggle-button-renderer button.style-scope.yt-icon-button');
var likes = buttons[0].attributes["aria-label"].nodeValue;
var dislikes = buttons[1].attributes["aria-label"].nodeValue;
var regex = /[\d,.]+/;
likes = likes.match(regex);
dislikes = dislikes.match(regex);
alert("Likes: " + likes + "\nDislikes: " + dislikes);
})();
@spacehuhn
spacehuhn / esp8266webserver_download_hack.md
Last active January 16, 2024 18:17
ESP8266 Webserver: send or download huge files

The Arduino webserver library from the ESP8266 is very simple and you can get to its limits pretty fast!

So that beeing said I first want to recommend you this library: ESPAsyncWebServer.
It's a very good alternative with a lot of features and it's easy to use.

However I wanna show you an easy way to hack around the standard webserver library for projects which can't make use of the ESPAsyncWebserver library.

So what we want to do is making the ESP8266 serve files via its webserver that are bigger than the RAM size we have left.
A picture for example. You don't want to hold that in the RAM, it's limited and way to valuable to be used for this.

@nonbeing
nonbeing / git-deployment.md
Last active April 2, 2024 14:24 — forked from noelboss/git-deployment.md
Simple deployment using git's post-receive hook

Also see: https://gist.github.com/lemiorhan/8912188

Simple automated deployment using git hooks

Here are the simple steps needed to push your local git repository directly to a remote (e.g. prod) server over ssh. This is based on Digital Ocean's Tutorial.

Overview

You are developing in a working-directory on your local machine, let's say on the master branch. Usually people push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use GitHub's webhooks to send a POST request to a webserver to take appropriate actions such as cloning/checking out a branch on the remote (prod) server.

@eugene-babichenko
eugene-babichenko / CMakeLists.txt
Last active July 1, 2023 18:01
CMakeLists.txt and toolchain file for building STM32 HAL-based projects generated with STM32CubeMX with arm-none-eabi-gcc. STM32CubeMX settings. Toolchain: SW4STM32. ☑ Generate under root.
set(PRJ_NAME CLion_STM_LED)
set(MCU_FAMILY STM32F1xx)
set(MCU_LINE STM32F103xB)
set(MCU_LINKER_SCRIPT STM32F103RBTx_FLASH.ld)
cmake_minimum_required(VERSION 3.6)
project(${PRJ_NAME} C ASM)
add_definitions(-D${MCU_LINE})
@lemiorhan
lemiorhan / post-receive
Last active February 8, 2023 10:06
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@joyrexus
joyrexus / README.md
Last active May 3, 2024 10:41 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})