Skip to content

Instantly share code, notes, and snippets.

@peterc
peterc / sinatra-react.md
Last active January 16, 2025 23:23
How to set up a basic Sinatra + React webapp

How to set up a basic Sinatra + React webapp in 2025

Let's say you want to use Ruby for the backend of a basic webapp but React on the frontend. Here's how.

(Note: All tested on January 13, 2025 with Ruby 3.3, Sinatra 4.1.1, and React 18.3. Configs may change over time.)

First, create the app folder and set up Sinatra:

mkdir my-sinatra-react-app
@101arrowz
101arrowz / README.md
Last active January 16, 2025 23:23
Download a McGraw Hill Education eTextbook

Download a McGraw Hill Education eTextbook

If you purchase a textbook from McGraw Hill, the website to view it is clunky and only works on some devices. You can't go to specific page numbers, the search is super slow, etc. That's why I wrote this script to download the textbook as an ePub file for your own viewing.

Using this script is 100% legal. McGraw Hill publicly hosts their ebooks online in order for their web client to download it. Moreover, to use it, you must already have purchased the book you would like to download, so it is legally yours to use as you please. However, it IS illegal to use this for piracy purposes. DO NOT DISTRIBUTE ANY TEXTBOOKS YOU DOWNLOAD USING THIS SCRIPT.

@peterlozano
peterlozano / Makefile
Last active January 16, 2025 23:20
Los Angeles Neighborhoods Map.
all: la.json
# Compose general json
la.json: la_county_neighborhoods_current.geojson
topojson \
-o la.json \
--id-property external_id \
--properties name=external_id \
-- \
la_county_neighborhoods_current.geojson
@IshanDaga
IshanDaga / proto-to-map.go
Created March 2, 2024 10:51
Create a go map from any proto message without proto->json->map
package main
import (
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/types/descriptorpb"
"google.golang.org/protobuf/types/dynamicpb"
)
@markknol
markknol / shadertoy.md
Last active January 16, 2025 23:16
Shader cheatsheet (from shadertoy)

This help only covers the parts of GLSL ES that are relevant for Shadertoy. For the complete specification please have a look at GLSL ES specification

Language:

Version: WebGL 2.0
Arithmetic: ( ) + - ! * / %
Logical/Relatonal: ~ < > <= >= == != && ||
Bit Operators: & ^ | << >>
Comments: // /* */
Types: void bool int uint float vec2 vec3 vec4 bvec2 bvec3 bvec4 ivec2 ivec3 ivec4 uvec2 uvec3 uvec4 mat2 mat3 mat4 mat?x? sampler2D, sampler3D samplerCube
Format: float a = 1.0; int b = 1; uint i = 1U; int i = 0x1;

@jacky9813
jacky9813 / install-nv-driver-fc41.md
Created October 31, 2024 01:47
Install NVIDIA proprietary driver on Fedora 41

There are some steps that is not documented in the RPMFusion's installation guide. Here's how I install NVIDIA driver on Fedora 41.

  1. Update all packages and reboot
  2. Install akmod-nvidia from RPMFusion, optionally with packages for CUDA or NVENC.
  3. For some reason, after akmod installation, I didn't see modeset=1 on kernel option, so:
#!/bin/bash
@Pathoschild
Pathoschild / stardew-mod-recommendations.md
Last active January 16, 2025 23:12
Stardew Valley mod recommendations

Here are the mods I recommend. These are all compatible with the latest versions of SMAPI and Stardew Valley on Linux/macOS/Windows. See the player's guide to using mods if you're interested.

Quality of life

I think the best mods are those which improve the game while maintaining its balance, lore, and style.

  • AutoGate
    Gates open automatically when you approach and close behind you.

  • Better Sprinklers Plus
    Customise the sprinkler radius, with a proportional change to their cost. If you're willing to mine all the ores you'll need, that makes the basic sprinklers useful early in the game and lets you do more than just watering crops every day.

import json
import re
import yfinance as yf
from txtai import Embeddings
from txtai.pipeline import Textractor
def djia():
"""
@Softwave
Softwave / README.md
Last active January 16, 2025 23:11
Fibonacci Program

Fib

Simple fibonacci number calculator.

Usage: fib nth Fibonacci number

@luigi-ms
luigi-ms / .vimrc
Last active January 16, 2025 23:11
Mine Vim/NeoVim config
" Basic Configs
syntax on
filetype on
filetype plugin indent on
set encoding=utf-8
set title
set number
set cursorline