Skip to content

Instantly share code, notes, and snippets.

View stereosupersonic's full-sized avatar

MICE Portal stereosupersonic

View GitHub Profile
@stereosupersonic
stereosupersonic / rails_prompt.md
Last active May 27, 2025 14:15
ruby on rails prompt

Ruby on Rails Development Guidelines

You are an expert Ruby on Rails developer. Your goal is to write sustainable, maintainable, and high-quality Rails code that adheres to established best practices. Always follow these coding standards and best practices:

Mindset

  • Optimize for low carrying cost, not short-term delivery speed.
  • Prioritize consistency over cleverness—make your future self and teammates grateful.
  • Be explicit, clear, and pragmatic. Don’t abstract prematurely.
  • If a trade-off is required, cut scope, not quality.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@stereosupersonic
stereosupersonic / miner.py
Created March 14, 2022 09:53
bitcoin miner
from hashlib import sha256
MAX_NONCE = 10000000
def create_sha256(text):
return sha256(text.encode("ascii")).hexdigest()
def mining(block_number, transactions, prev_hash, difficulty):
def remote_file_exits?(url, limit=10)
raise ArgumentError, 'too many HTTP redirects' if limit == 0
uri = URI(url)
response = Net::HTTP.get_response(uri)
case response
when Net::HTTPNotFound then
false
@stereosupersonic
stereosupersonic / rubocop.yml
Created December 1, 2020 06:50
rubocop basics settings
AllCops:
Include:
- '**/*.rb'
- '**/*.rake'
- '**/Gemfile'
Exclude:
- '**/tmp/**/*'
- '**/vendor/**/*'
- '**/node_modules/**/*'

Visual Studio Code

install

brew cask install visual-studio-code

settings

Code > Preferences > Settings

{
@stereosupersonic
stereosupersonic / open_ny_times.sh
Created November 16, 2020 17:07
Open then latest new york times front page
open https://static01.nyt.com/images/$(date +"%Y/%m/%d")/nytfrontpage/scan.pdf
#!/usr/bin/env ruby
MAX_RETRY = 3
PATH = "/sys/bus/iio/devices/"
TEMP_SENSOR = PATH + "iio\:device#{ARGV[0].to_i}/in_temp_input"
HUMIDITY_SENSOR = PATH + "iio\:device#{ARGV[0].to_i}/in_humidityrelative_input"
def save_read(sensor)
run = 1
while run < MAX_RETRY

My raspberry pi setup

create a bootable card

boot new raspberry PI

  • find IP in your network e.g. nmap -sP 192.168.1.*
  • login with ssh pi@ password: raspberry
@stereosupersonic
stereosupersonic / Gemfile
Created June 26, 2020 06:13 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers