Skip to content

Instantly share code, notes, and snippets.

View leckylao's full-sized avatar
🎯
Focusing

Lecky Lao leckylao

🎯
Focusing
View GitHub Profile
@leckylao
leckylao / mysql-docker.sh
Created September 11, 2017 10:32 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@leckylao
leckylao / gist:6153513
Created August 5, 2013 04:29
Ruby Warrior Epic Mode 3 years ago: Level Score: 74 Time Bonus: 13 Clear Bonus: 17 Level Grade: S Total Score: 526 + 104 = 630 Your average grade for this tower is: S Level 1: S Level 2: A Level 3: S Level 4: S Level 5: A Level 6: S Level 7: S Level 8: S Level 9: S
class Player
def play_turn(warrior)
@action = false
@direction ||= :forward
# shoot_backward!
if warrior.look(:backward)[2].enemy? and !@action
warrior.shoot!(:backward)
@action = true
end
@leckylao
leckylao / gist:6153567
Created August 5, 2013 04:41
Ruby Warrior Epic Mode: Level Score: 74 Time Bonus: 5 Clear Bonus: 16 Level Grade: A Total Score: 510 + 95 = 605 Your average grade for this tower is: A Level 1: S Level 2: A Level 3: S Level 4: S Level 5: A Level 6: A Level 7: S Level 8: S Level 9: A
class Player
def play_turn(warrior)
@direction ||= :forward
@opposite_direction = opposite_direction(@direction)
@warrior = warrior
@rest ||= false
@action = false
@health ||= warrior.health
@turn ||= 1
@hit_at_start ||= false
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
@leckylao
leckylao / validate_unvarifies.sh
Created February 1, 2013 04:58
script for validating unvarified.txt from https://gist.github.com/4685276/download#
#!/usr/bin/env sh
set -e
cat unverified | xargs -n 2 -P 20 ./validate_unverify.sh
@leckylao
leckylao / validate_checksum.sh
Created February 1, 2013 05:05
validate local cache gem checksums with the one from RubyGems (SHA512): http://cl.ly/MYie
#!/usr/bin/env sh
set -e
sum=$1
gem=$(basename $2)
dir=${gem/.gem/}
home=$(gem env GEM_HOME)
# cd latest/$dir
---
:verbose: true
:benchmark: false
http_proxy: http://localhost:3128
:backtrace: true
:bulk_threshold: 1000
:update_sources: true
:sources:
- http://rubygems.org/
- http://gems.nms.local:9998
#!/bin/sh
# generate tag file for lookupfile plugin
echo -e "!_TAG_FILE_SORTED\t2\t/2=foldcase/" > filenametags
find . -not -regex '.*\.\(png\|gif\|csv\|jpg\|jpeg\|html\)' -not -regex '\./db/migrate/.*' -not -regex '\./\.git/.*' -not -regex '\./\.escm/.*' -not -regex '\./.*\.escm_ignore' -not -regex '\./.*\.svn.*' -not -regex '\./report/.*' -type f -printf "%f\t%p\t1\n" | \
sort -f >> filenametags
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
[core]
autocrlf = false
editor = gvim
[color]
ui = auto
[alias]
st = status
ci = commit
br = branch
co = checkout