Skip to content

Instantly share code, notes, and snippets.

@ggorlen
ggorlen / bitbucket.md
Last active February 27, 2024 19:34
git cheatsheet
@ggorlen
ggorlen / better-browsing.md
Last active March 17, 2026 14:30
Better browsing
@ggorlen
ggorlen / server.js
Last active June 15, 2023 00:42
Server-sent events example
// see: https://stackoverflow.com/a/67184841/6243352
const express = require("express");
const app = express();
app.get("/stream", (req, res) => {
res.writeHead(200, {
//"Access-Control-Allow-Origin": "*",
//"Content-Encoding": "none",
"Connection": "keep-alive",
"Cache-Control": "no-cache",
@ggorlen
ggorlen / ssh_to_virtualbox.md
Created April 30, 2021 21:27
How to SSH into CS6340's Virtual Box

Setup:

  1. Download the course .ova file and import it into the VirtualBox manager with File -> Import Appliance.
  2. Follow this tutorial: https://stackoverflow.com/questions/5906441/how-to-ssh-to-a-virtualbox-guest-externally-through-a-host to configure port forwarding on the VM. This is the critical resource!

On the VM:

  1. Start the VM in the VirtualBox manager.
  2. Run sudo apt install sshd. It will automatically start.
@ggorlen
ggorlen / random.md
Last active February 5, 2022 02:53
random data in many languages

C

Random string

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@ggorlen
ggorlen / compile_c.sh
Created July 30, 2021 02:03
Compile C script
#!/usr/bin/env bash
if [ "$#" -ne 2 ]; then
echo "Usage: ./compile_c.sh in.c out.out"
exit 1
elif [ $1 -eq $2 ]; then
echo "error: overwriting source file '$1'"
exit 1
fi
@ggorlen
ggorlen / jq-cheatsheet.md
Last active June 3, 2025 16:20
jq cheatsheet

JQ Cheatsheet

Sample JSON 1:

{
  "data": [
    {
      "bar": "blah",
      "quux": "garply",