Skip to content

Instantly share code, notes, and snippets.

@Widdershin
Widdershin / ssr.md
Last active May 1, 2024 17:36
The absurd complexity of server-side rendering

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?

In dark rooms, in hushed tones, we speak of colours.

@ckabalan
ckabalan / best_bash_history.sh
Last active May 1, 2024 17:29
The Best Bash History Settings Ever
# /etc/profile.d/best_bash_history.sh
# Save 5,000 lines of history in memory
HISTSIZE=10000
# Save 2,000,000 lines of history to disk (will have to grep ~/.bash_history for full listing)
HISTFILESIZE=2000000
# Append to history instead of overwrite
shopt -s histappend
# Ignore redundant or space commands
HISTCONTROL=ignoreboth
# Ignore more
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 1, 2024 17:28
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@hhkaos
hhkaos / script.md
Last active May 1, 2024 17:28
From Zero to Newbie with ArcGIS API for JS and TypeScript

From zero to newbie with ArcGIS API for JS and TS.

Hello TypeScript demo

Initialize a typescript project:

npm init -y
npm i typescript --save-dev
@CreatureSurvive
CreatureSurvive / HeaderAttribute.cs
Last active May 1, 2024 17:26
Better inspector headers in Unity
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
//using CS;
//[System.Serializable]
//public class HeaderExampleClass
//{
// [Header("My Fields", 3)]
@fhferreira
fhferreira / RetryAllFailedJobsCommand.php
Created December 8, 2023 04:01 — forked from ulcuber/RetryAllFailedJobsCommand.php
Laravel Horizon. Retry all of the failed jobs like one in the horizon dashboard
<?php
namespace App\Console\Commands\Horizon;
use Illuminate\Console\Command;
use Illuminate\Queue\Failed\FailedJobProviderInterface;
use Laravel\Horizon\Contracts\JobRepository;
use Laravel\Horizon\Jobs\RetryFailedJob;
class RetryAllFailedJobsCommand extends Command
@spencer741
spencer741 / VM_RDP_Manager.ps1
Last active May 1, 2024 17:25
PowerShell Script - Azure VM Start and Stop, with RDP contingency (single connection).
# Self-elevate the script if required
"`Self Elevating...`n"
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
}
@portellam
portellam / README.md
Last active May 1, 2024 17:26
Bash Explained: "Classes", References, and Inherited Variables

Bash Explained: "Classes", References, and Inherited Variables

(In)famous developer and devout Christian, Terry Davis, has said an idiot admires complexity, a genius admires simplicity.

When you see my code examples and my code-style in Bash, you may think I'm a bit of both.

Table of Contents

@BenHurMartins
BenHurMartins / index.js
Last active May 1, 2024 17:22
Double or Single Tap
import { useEffect, useState } from "react";
import { Pressable, StyleSheet, Text, View } from "react-native";
let timer = null;
const TIMEOUT = 500
const debounce = (onSingle, onDouble) => {
if (timer) {
clearTimeout(timer);
timer = null;
onDouble();
@qskwood
qskwood / wget-warc-generator
Last active May 1, 2024 17:21
This script uses wget to generate a WARC that can be read by a player like OpenWayback and places it into a directory. It also handles creation and use of CDX indexes for de-duplication.
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Must only have two arguments, the URL and the collection" >&2
exit 1
fi
if [[ ! -d "/var/spool/openwayback/files2/${2}" ]]; then
mkdir "/var/spool/openwayback/files2/${2}"
fi