Skip to content

Instantly share code, notes, and snippets.

@Beyarz
Beyarz / insta.js
Last active August 29, 2025 14:17
Instagram profile auto scroll to bottom
// https://www.instagram.com/USER
const observer = new MutationObserver((mutations) => window.scrollTo(0, document.body.scrollHeight));
const profileNode = document.querySelector('main');
if (profileNode) {
observer.observe(profileNode, { childList: true, subtree: true });
window.scrollTo(0, document.body.scrollHeight);
}
@Beyarz
Beyarz / Gemfile
Created June 24, 2025 17:46
Mini RAG, ask questions to a little language model about your data
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'informers', '~> 1.2'
gem 'pry', '~> 0.15.2', group: :development
gem 'solargraph', '~> 0.55.2', group: :development
@Beyarz
Beyarz / main.dart
Created June 21, 2025 21:01
Dart.dev Shopping list example
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
@Beyarz
Beyarz / README.md
Created May 10, 2025 14:36
Chat with a friend through LAN. script I wrote 8 years ago. Adding it here for memory.

Talkwithme

One script, two purposes.

Setup guide (server)

  • Run python2 talkwithme.py
  • Press 1 then hit enter
  • Enter your private ip address (it will be printed out)
  • Enter any port number (that is not in use)
  • Enter the clients ip address
  • Enter the clients port number
@Beyarz
Beyarz / howbout.rb
Created December 24, 2024 17:19
Create plans on howbout.app
# frozen_string_literal: true
require 'net/http'
require 'uri'
require 'json'
require 'securerandom'
MY_API_KEY = "..."
BEARER = "..."
BAGGAGE = "..."
@Beyarz
Beyarz / power_set.rb
Last active January 1, 2025 18:07
Calculate power set from an array
arr = [1, 2, 3]
# => [1, 2, 3]
def power_set(arr)
result = [[]]
arr.each do |element|
result += result.map do |num|
num + [element]
end
@Beyarz
Beyarz / bulk_rename.rb
Created August 8, 2024 21:13
Rename every folder in a directory
# frozen_string_literal: true
# Put me in a folder where you want to bulk rename every folder
# In this case, this script will rename every folder from "Photos from YEAR" to "YEAR" only
# Run: ruby bulk_rename.rb
folders = Dir.entries('.').reject { ['.', '..'].include? _1 }
folders.each do |folder|
File.rename(File.join(Dir.pwd, folder), File.join(Dir.pwd, folder.delete_prefix("Photos from ")))
end
@Beyarz
Beyarz / flatten.rb
Last active August 9, 2024 17:57
Flatten a directory structure and its hierarchy. This script moves every file in a subfolder to its parent and then delete the subfolder
# frozen_string_literal: true
# Put me in a folder where you want to get rid of all the subfolders
# Run: ruby flatten.rb
def move_and_delete(dir)
puts "Cleaning \"#{dir}\""
Dir.foreach(dir) do |file|
next if ['.', '..'].include?(file)
@Beyarz
Beyarz / collision.c
Created June 8, 2024 12:42
Check collision between a circle and a rectangle
#include <math.h>
typedef float f32;
typedef struct Vector2
{
f32 x, y;
} Vector2;
typedef SDL_FRect RectangleF;
typedef struct Circle
@Beyarz
Beyarz / common.h
Created June 8, 2024 12:37
Shorter typdefs
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef size_t umax;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;