Skip to content

Instantly share code, notes, and snippets.

@yfkhar
yfkhar / patch-edid.md
Created February 21, 2024 11:17 — forked from ejdyksen/patch-edid.md
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):

@yfkhar
yfkhar / fixmouselag.sh
Created May 25, 2023 14:59 — forked from rscircus/fixmouselag.sh
Fix bluetooth mouse lag on Ubuntu
#!/bin/bash
MouseIdentifierString="Mouse"
writeOpts() {
sudo cat <<'EOF' | sudo tee -a /var/lib/bluetooth/$1/$2/info
[ConnectionParameters]
MinInterval=6
MaxInterval=7
Latency=0
@yfkhar
yfkhar / tm_properties
Created September 3, 2022 11:14 — forked from belgoros/tm_properties
TextMate 2 Settings
spellChecking = true
spellingLanguage = 'en'
softTabs = true
softWrap = false
invisiblesMap = "~ \t┊"
TM_STRIP_WHITESPACE_ON_SAVE = true
TM_GIT = "/usr/local/bin/git"
TM_RUBY = "/usr/local/var/rbenv/shims/ruby"
@yfkhar
yfkhar / Spree: Filter by brand.md
Created June 13, 2022 19:47 — forked from vsokolov/Spree: Filter by brand.md
Spree: Filter Products by properties

Fix 'scoped' error for Rails 4

error: undefined method 'scoped' solution:

# config/initializers/scoped.rb
class ActiveRecord::Base
  # do things the modern way and silence Rails 4 deprecation warnings
 def self.scoped(options=nil)

options ? where(nil).apply_finder_options(options, true) : where(nil)

@yfkhar
yfkhar / freebsd-bluetooth-mouse.txt
Created February 6, 2022 19:21
Configure FreeBSD Bluetooth Mouse
Add to /boot/loader.conf:
ng_ubt_load="YES"
Add to /etc/rc.conf:
hcsecd_enable="YES"
sdpd_enable="YES"
bthidd_enable="YES"
Reboot, or run:
@yfkhar
yfkhar / how-to-git-patch-diff.md
Created October 5, 2021 21:32 — forked from nepsilon/how-to-git-patch-diff.md
How to generate and apply patches with git? — First published in fullweb.io issue #33

How to generate and apply patches with git?

It sometimes happen you need change code on a machine from which you cannot push to the repo. You’re ready to copy/paste what diff outputs to your local working copy.

You think there must be a better way to proceed and you’re right. It’s a simple 2 steps process:

1. Generate the patch:

git diff &gt; some-changes.patch
@yfkhar
yfkhar / install-clamav-osx.md
Created July 27, 2021 05:23 — forked from gagarine/install-clamav-osx.md
Howto Install clamav on OSX with brew

Howto Install clamav on OSX with brew

$ brew install clamav
$ cd /usr/local/etc/clamav
$ cp freshclam.conf.sample freshclam.conf

Open freshclam.conf and comment the "Example" (in new version it may be "FooClam") line:

@yfkhar
yfkhar / routes.rb
Created July 1, 2021 10:13 — forked from pixeltrix/routes.rb
Examples of advanced Rails 3.0 routes
Rails.application.routes.draw do
get '/(:locale)/products/(:category)/(page/:page).:extension',
:to => 'products#index',
:as => :products,
:constraints => {
:locale => /[a-z]{2}/,
:category => /.+?/,
:page => /\d+/
},
@yfkhar
yfkhar / db_backup.rb
Created November 14, 2020 00:48 — forked from ahmadhasankhan/db_backup.rb
MySQL DB backup script in Ruby CMD
#1===========First code================
#!/usr/bin/env ruby
databases = {
:local_db => {
:database => 'my_db',
:username => 'root',
:password => 'admin',
:host => 'localhost'