Skip to content

Instantly share code, notes, and snippets.

// Credits: https://www.geeksforgeeks.org/how-to-get-the-full-url-in-expressjs/
const express = require('express');
const app = express();
const PORT = 3000;
app.get('*', function (req, res) {
const protocol = req.protocol;
const host = req.hostname;
const url = req.originalUrl;
<meta name="viewport" content="width=device-width, initial-scale=1">
@BlazerYoo
BlazerYoo / index.html
Created August 2, 2022 21:19
tornado
<!DOCTYPE html>
<html>
<head>
<title>Chat application</title>
</head>
<body>
<div style="width:100%; padding: 20px; overflow-y: scroll;">
<div id="messages"></div>
<div style="padding-top: 20px;">
<form onsubmit="return sendMessage()">
echo " __ __ __ __ ___ __ __ __ __ __ _____ __ "
echo "/ / \(_ _) /| / |__)|_ |__)/ \ (_ |_ | / \|__) "
echo "\__\__/__) /__ | / | \ |__| \__/ __)|__ | \__/| "
echo
echo
# $1 - github username
# $2 - name of COS217 template repo
# $3 - name of your private github repo
@BlazerYoo
BlazerYoo / bulma-setup.sh
Created April 1, 2023 04:11
Use bash script to set up node-sass for Bulma (adapted from https://bulma.io/documentation/customize/with-node-sass/)
echo 'MAKING BULMA DIRECTORY...'
mkdir bulma-sass
cd bulma-sass
echo $'\nSpecify entry point: sass/styles.scss'
echo $'\nINITIALIZING NPM PROJECT...'
npm init
echo $'\nINSTALLING DEPENDENCIES...'
npm install node-sass --save-dev
@BlazerYoo
BlazerYoo / modern-hosting-2021.md
Created April 4, 2023 22:46 — forked from wiverson/modern-hosting-2021.md
List of free hosting services (that also offer options to scale up for $) in 2021

Italics means the text/description is directly from the vendor, usually the slug line on their home page.

Non-italics means it's my comments/editorial.

Static Sites

  • Surge
    • Static web publishing for Front-End Developers
    • Simple, single-command web publishing. Publish HTML, CSS, and JS for free, without leaving the command line.
@BlazerYoo
BlazerYoo / java.sh
Created May 13, 2023 02:37
Compile and execute Java programs in one line
#!/bin/bash
# Compile Java program
javac $1.java
# Check if compilation was successful
if [ $? -eq 0 ]; then
# Execute Java program with command line arguments
java $1 "${@:2}"
from IPython.display import JSON
from google.colab import output
from subprocess import getoutput
import os
def shell(command):
if command.startswith('cd'):
path = command.strip().split(maxsplit=1)[1]
os.chdir(path)
return JSON([''])
window.addEventListener('beforeunload', (event) => {
// Cancel the event as stated by the standard.
event.preventDefault();
// Chrome requires returnValue to be set.
event.returnValue = '';
});
@BlazerYoo
BlazerYoo / ansi_colors.json
Created February 11, 2024 01:57
Ansi colors
{
"fg_default": 39,
"bg_default": 49,
"fg_black": 30,
"bg_black": 40,
"fg_red": 31,
"bg_red": 41,
"fg_green": 32,
"bg_green": 42,