Skip to content

Instantly share code, notes, and snippets.

@Davidblkx
Davidblkx / keyboard.sh
Created May 18, 2020 22:43
Enable/Disable laptop keyboard using XINPUT
#/bin/bash
#######################################
# Enables or disables laptop keyboard #
#######################################
# Keyboard name to work with
KB_NAME="AT Translated Set 2 keyboard"
# Grab keyboard ID
KB_ID=$(xinput list | grep "$KB_NAME" | awk '{ print $7 }' | sed -r 's/id=//g')
@cdesch
cdesch / rails_generator_cheat_sheet.md
Last active March 30, 2024 09:07
Rails Generator CheatSheet

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.

@vertexclique
vertexclique / cracking.md
Last active April 8, 2024 18:24
Cracking guide for Sublime Text 3 Build 3059 / 3065 ( Mac / Win x86_64 / Windows x86 / Linux x64 / Linux x86 )

MacOS

Build 3059

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to: Sublime Text

Make it executable with: chmod u+x Sublime\ Text

@sumskyi
sumskyi / README.md
Last active June 7, 2022 18:49
rails STI with custom "type" field and storing there value different from ClassName

GeoEntity.last

SELECT geo_entities.* FROM geo_entities ORDER BY geo_entities.id DESC LIMIT 1

returns:

County id: 4, eid: nil, pid: nil, ename: nil, etype: 2, created_at: "2011-11-21 06:26:37", updated_at: "2011-11-21 06:26:37"

# (1) copy the newrelic rpm java client into #{RAILS_ROOT}/solr/newrelic
# (2) add a newrelic.yml in that directory with you API key
# (3) add this monkey patch in an initializer to load newrelic with the solr server
Sunspot::Server.class_eval do
def run
command = ['java']
command << "-Xms#{min_memory}" if min_memory
command << "-Xmx#{max_memory}" if max_memory
command << "-Djetty.port=#{port}" if port
command << "-Dsolr.data.dir=#{solr_data_dir}" if solr_data_dir