Skip to content

Instantly share code, notes, and snippets.

@ilyakatz
ilyakatz / pre-commit
Last active February 22, 2023 14:51
helpful precommit hooks
#!/bin/bash -l
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#
.git/hooks/pre-commit-master-no-no
if [[ $? == 1 ]]
then
#base on http://ariejan.net/2011/09/24/rspec-speed-up-by-tweaking-ruby-garbage-collection
class DeferredGarbageCollection
MEM_FREE_FOR_GC_THRESHOLD = (ENV['MEM_FREE_FOR_GC_THRESHOLD'] || 500).to_f
@@last_gc_run = Time.now
def self.start
GC.disable if MEM_FREE_FOR_GC_THRESHOLD > 0
end
<!--
1. /System/Library/LaunchDaemons/nginx.plist
2. to load: sudo launchctl load -F /System/Library/LaunchDaemons/nginx.plist
3. to unload: sudo launchctl unload /System/Library/LaunchDaemons/nginx.plist
-->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Phone = #777
ISDN = 0
Password = yourpassword
Username = XXX-XXX-XXXX
Modem = /dev/ttyUSB1
Baud = 921600
Stupid Mode = on
@ilyakatz
ilyakatz / chrubuntu12.04.md
Last active December 17, 2015 05:59
html5 video

Ubuntu 12.04 on Samsung ChromeBook

Prerequisites

  • perform system update
    • if you do it later it will ask for all kind of permissions to override various config files
    • change password for root
      • default password is user

###Fix trackpad sudo apt-get install git

@ilyakatz
ilyakatz / Readme.md
Last active March 5, 2020 12:19
MixPanel job for Dashing

Description

Simple Dashing job to display total number of events in MixPanel .

##Preview

##Dependencies

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" update ack command to be able to search through the gem files
:autocmd BufEnter * call SetCurrentGemHome()
function! SetCurrentGemHome()
call UpdateGemPath()
:command! -nargs=* AckGems execute 'Ack' <q-args> $GEM_PATH
endfunction
function! UpdateGemPath()
let $GEM_PREFIX=system("rbenv prefix")

In order to use asset pipeline available for static error pages (like 404.html), a few steps are required

  • Move static pages from /public into /app/assets

    (eg: public/422.html → app/assets/html/422.html.erb)

  • Add html directory to the asset pipeline

  • Update exceptions middleware to understand assets with digests

@ilyakatz
ilyakatz / primary_key_autoincrement. rb
Created February 5, 2014 19:30
Update the value of the primary key auto increment for a model in rails
klazz = SoftwareMember
klazz .connection.execute("ALTER TABLE #{klazz .table_name} AUTO_INCREMENT = 1000")
@ilyakatz
ilyakatz / abd_broadcase_receivers.sh
Created March 9, 2014 14:33
List all registered BroadcastReceivers
#statuc
adb shell dumpsys activity b
# dynamic
adb shell dumpsys package