Skip to content

Instantly share code, notes, and snippets.

@djburdick
djburdick / gist:5027458
Created February 25, 2013 03:53
git merge. #git
1. Start with a clean working directory
2. current branch is always the target
3. investigate conflicts with git diff (or git mergetool)
4. edit conflicting files
5. git add file
6. git commit
Aborting a merge:
git reset --hard HEAD # prior to merge commit
@djburdick
djburdick / gist:5027652
Created February 25, 2013 04:00
Linux Top cheatsheet . #linux
us = user cpu
sy = system cpu
id = idle CPU (high is good)
wa = I/O wait (either RAM or disk. High here means prob not a cpu issue)
Mem: free + Swap cached = actual free RAM
iostat
#
Load average is the last: 1, 5 and 15 minutes.
@djburdick
djburdick / gist:5027494
Last active August 8, 2023 05:52
Redis rails commands. #rails #redis
Rails.redis.get(key)
Rails.redis.set(key, value)
Rails.redis.expire(key, 1.hour)
Rails.redis.del(key)
Rails.redis.sadd(set_name, value)
Rails.redis.srem(set_name, key)
Rails.redis.sismember(set_name, value) # boolean test to see if val exists
@djburdick
djburdick / rubocop_circleci.rb
Created November 11, 2014 20:18
Run rubocop with circleci
# In spec_helper.rb
RSpec.configure do |config|
....
rubocop_output = `rubocop`
print rubocop_output
fail "RuboCop Errors" unless rubocop_output.match(/files inspected, no offenses detected/)
end
@djburdick
djburdick / gist:5027576
Created February 25, 2013 03:57
ruby exceptions. #ruby
begin
rescue
end
#> lower_bound upper_bound fdo_count_to_suspend_on
#> 1 0 18 2
#> 2 19 86 3
#> 3 87 180 4
#> 4 181 310 5
#> 5 311 inf 6
@djburdick
djburdick / docker_cheatsheet
Last active May 28, 2019 18:21
Docker cheatsheet
Commands:
docker run hello-world # run container
docker run -d -p 4000:80 hello-world # run in the background on port 4000
docker container stop CONTAINER_ID # stop container id
docker stop $(docker ps -a -q) # stop all containers
docker image ls # list images
docker container ls --all # list all containers
docker build -t appname . # build the app in currect dir
@djburdick
djburdick / gist:5027582
Created February 25, 2013 03:57
ruby variable method names (send). #ruby
Object.send(var)
request = gets
if ticket.respond_to?(request)
puts ticket.send(request)
end
@djburdick
djburdick / gist:5027525
Created February 25, 2013 03:55
characters from a string ruby. #ruby
string = mystring
string[0].chr
@djburdick
djburdick / gist:5027524
Created February 25, 2013 03:55
ruby module with self method. #ruby
module Party
def full_party?
self == 8? true : false
end
end
include Party
class People