Skip to content

Instantly share code, notes, and snippets.

View cbilgili's full-sized avatar

Canbey Bilgili cbilgili

  • Istanbul
View GitHub Profile
@cbilgili
cbilgili / gist:4584855
Created January 21, 2013 09:33
How to turn off the iMac display
How to turn off the iMac display
CONTROL + SHIFT + EJECT
@cbilgili
cbilgili / gist:5813063
Created June 19, 2013 09:44
Ruby string merge sprintf
You can use sprintf-like formatting to inject values into the string. For that the string must include placeholders. Put your arguments into an array and use on of these ways: (For more info look at the documentation for Kernel::sprintf.)
fmt = 'The %s %s the %s'
res = fmt % [animal, action, other_animal] # using %-operator
res = sprintf(fmt, animal, action, other_animal) # call Kernel.sprintf
You can even explicitly specify the argument number and shuffle them around:
'The %3$s %2$s the %1$s' % ['cat', 'eats', 'mouse']
Or specify the argument using hash keys:
@cbilgili
cbilgili / gist:5943844
Last active December 19, 2015 10:58
Ubuntu apache2 restart
sunucu restart
sudo /etc/init.d/apache2 restart
domain
cd /etc/apache2/sites-available/
sudo a2dissite default
sudo a2ensite xxxxx.com
@cbilgili
cbilgili / gist:6683405
Last active December 23, 2015 19:29
terminal file copy scp
local to remote
scp -i ~/.ssh/supernomads.pem supernomads.com.crt ubuntu@54.229.19.140:~/.
~/.ssh klasöründeyken
rsync -avL --progress -e "ssh -i ./supernomads.pem" ~/Downloads/kibo_image/* ubuntu@54.72.111.93:/tmp/.
rsync -rave "ssh -i ./supernomads.pem" ~/Downloads/kibo_image/* ubuntu@54.72.111.93:/tmp/.
remote to local
scp -r user@your.server.example.com:/path/to/foo /home/user/Desktop/
@cbilgili
cbilgili / gist:7098731
Created October 22, 2013 11:06
rspec spec --format nested. rspec testi formatlı ekrana yazdırmak
rspec spec --format nested.
# Filter payment methods in Spree depending on the shipping name,
# use the following snippet within your activation method to
# make it work:
#
# CheckoutsController.class_eval { include FilterPaymentMethods }
#
# The magic happens within the InstanceMethods module, change the
# regexp to fit your needs.
#
# Kai Krakow, http://github.com/kakra
@cbilgili
cbilgili / gist:9392200
Created March 6, 2014 15:30
Git Initializing
Git Config
Check your Git configuration parameters:
$ git config -l --global
user.name=Daniel Kehoe
user.email=daniel@danielkehoe.com
The email address will identify you to any services that use your Git repo, such as GitHub and Heroku.
Life will be easier if you use the same email address for all services where you use Git (so sign up for GitHub and Heroku using the same address).
@cbilgili
cbilgili / Public key to remote
Created July 12, 2014 09:37
Local SSH public keyi sunucuya eklemek. Sunucuya şifresiz bağlanabiliriz.
Local SSH public keyi sunucuya eklemek. Sunucuya şifresiz bağlanabiliriz.
cat ~/.ssh/id_rsa.pub | ssh deployer@178.xxx.xxx.xxx 'cat >> ~/.ssh/authorized_keys'
@cbilgili
cbilgili / gist:6efdf06635fe17e5df5e
Last active August 29, 2015 14:13
iterm2 sağ sol silme sekme tab gitme
I'm in Lion
with iTerm2, Zsh and Oh-My-Zsh
but I cannot move through words when pressing: ALT+left arrow or CMD+left arrow or something
instead, when I press "ALT+right arrow" it prints [C and when I press "SHIFT+ALT+left arrow" it prints D0
how I can config iTerm2 to behave like any other program when moving through words?
*********
@cbilgili
cbilgili / foreman.cap
Created March 19, 2015 15:00
Foreman unicorn upstart rbenv
set :unicorn_port, 5087
namespace :foreman do
desc "Export the Procfile to Ubuntu's upstart scripts"
task :export do
on roles(:app) do
within current_path do
execute :rbenv, :sudo, "foreman export upstart /etc/init --procfile=./Procfile -a #{fetch(:application)} -p #{fetch(:unicorn_port)} -u #{fetch(:user)} -l #{shared_path}/log"
end