Skip to content

Instantly share code, notes, and snippets.

View christiangenco's full-sized avatar

Christian Genco christiangenco

View GitHub Profile
@christiangenco
christiangenco / hash_array_to_csv.rb
Created June 6, 2014 04:26
Ruby hash array to CSV
class Array
def to_csv(csv_filename="hash.csv")
require 'csv'
CSV.open(csv_filename, "wb") do |csv|
csv << first.keys # adds the attributes name on the first line
self.each do |hash|
csv << hash.values
end
end
end
@christiangenco
christiangenco / ViewController.swift
Created December 30, 2020 02:13
Minimal macOS Swift app to show webcam video in a custom NSView
import Cocoa
import AVFoundation
// inspiration: https://www.youtube.com/watch?v=1_PUdhLQsZQ
class ViewController: NSViewController {
@IBOutlet weak var videoView: NSView!
private var cameraSession = AVCaptureSession()
private var camera: AVCaptureDevice!
@christiangenco
christiangenco / alacritty-theme-switcher.sh
Last active March 6, 2026 17:47
Claude code automatic dark/light mode theme switching
#!/bin/bash
# Check if macOS is in dark mode
# Returns "Dark" if dark mode is on, nothing if light mode
DARK_MODE=$(defaults read -g AppleInterfaceStyle 2>/dev/null)
# Path to the active color config file
COLOR_FILE="$HOME/.config/alacritty/color.toml"
if [ "$DARK_MODE" = "Dark" ]; then
@christiangenco
christiangenco / download website assets
Created January 20, 2014 23:23
Use wget to download a website's assets, including images, css, javascript, and html. From http://www.linuxjournal.com/content/downloading-entire-web-site-wget
$ wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--domains website.org \
--no-parent \
www.website.org/tutorials/html/
@christiangenco
christiangenco / brightness
Created February 6, 2026 03:39
Software brightness control for Hyprland via hyprsunset — gamma dimming with warm color shift at low levels
#!/bin/bash
# Software brightness control via hyprsunset
# Usage: brightness up|down|set <value>
# Stores state in ~/.local/state/brightness
#
# Two phases:
# 100% → 15%: reduce gamma (dims the screen while maintaining contrast)
# 15% → 0%: gamma stays at 15%, temperature shifts warm (6500K → 2000K)
# This "dims" further by removing blue light, keeping readability
@christiangenco
christiangenco / download_tapeacall.rb
Last active January 6, 2026 20:04
Export all recordings from TapeACall
require 'json'
require 'time'
recordings = JSON.parse(ARGF.read)
recordings.each{|recording|
timestamp = Time.at(recording["created"].to_i).strftime("%Y-%m-%d %H.%M.%S")
destination = File.expand_path("#{timestamp}.mp3")
cmd = "curl \"#{recording["url"]}\" > \"#{destination}\""
puts cmd
@christiangenco
christiangenco / film_list.txt
Created January 4, 2026 15:21
Film collection - mark films you'd like to watch
============================================================
FILM COLLECTION
============================================================
CLASSIC/ADULT FILMS (120 titles)
----------------------------------------
[ ] 12 Angry Men (1957)
[ ] A Clockwork Orange (1971)
[ ] A Night at the Opera (1935)
[ ] A Place in the Sun (1951)
@christiangenco
christiangenco / migrateHeroicons.js
Last active March 27, 2025 08:05 — forked from PicchiKevin/migrate.sh
Heroicons v1 to v2
const fs = require("fs");
if (!fs.existsSync("package.json")) {
console.error(
"Cannot find package.json. Please run this script in your project directory."
);
process.exit(1);
}
const package = fs.readFileSync("package.json", "utf8");
@christiangenco
christiangenco / nerdle_wordlist.txt
Last active April 30, 2024 11:33
Here's my best shot at a the 17,723-long wordlist for https://nerdlegame.com/
11-2-9=0
11-3-8=0
11-4-7=0
11-5-6=0
11-6-5=0
11-7-4=0
11-8-3=0
11-9-2=0
12-2*6=0
12-3-9=0