Skip to content

Instantly share code, notes, and snippets.

View lirenyeo's full-sized avatar
🏇
Keep going!

Liren lirenyeo

🏇
Keep going!
View GitHub Profile
@lirenyeo
lirenyeo / brightness.md
Last active November 8, 2021 15:08
Control screen brightness using xrandr
#!/bin/bash
# brightness: Change all monitors brightness in software.
# by hackerb9, 2019,2021

# Examples:  brightness 75;  brightness -10; brightness +10
# Usage:
#	brightess [n] [+n] [-n]
#	n	An integer from 0 to 100 specifies a brightness level.
#	+n	Increase brightness by n.
@lirenyeo
lirenyeo / shihtzu_formtastic.md
Created May 25, 2022 14:21
Using Flag ShihTzu with Formtastic

FlagShihTzu + Formtastic + Active Admin

To get all flags available in a model:

User.flag_mapping
User.flag_options
User.flag_columns
@lirenyeo
lirenyeo / sendgrid_qr_label.html
Created June 8, 2022 06:26
SendGrid Codeblock for QR label
<div style="background: white; text-align: center; padding-top: 1em; padding-bottom: 1em;">
<img src="{{qr_label}}" width="160" />
<div>{{qr_code}}</div>
</div>
@lirenyeo
lirenyeo / rails-nested-attributes-association.rb
Last active June 10, 2023 07:07
Rails Nested Attributes vs Build from Association
class User < ApplicationRecord
has_many :posts
accepts_nested_attributes_for :posts, allow_destroy: true
has_one :profile
accepts_nested_attributes_for :profile
end
# To create nested records through the parent: