Skip to content

Instantly share code, notes, and snippets.

View iamtekeste's full-sized avatar
🕺
having fun with code

Tekeste Gebreanenia iamtekeste

🕺
having fun with code
View GitHub Profile
@iamtekeste
iamtekeste / Copy Single file to multiple directories
Last active August 29, 2015 13:56
Copy Single file to multiple directories
#Linux
echo dir1 dir2 dir3 | xargs -n 1 cp file1
#Windows
for /d %F in (e:\*) do @if /i "%F" neq "e:\wav" 2>nul xcopy "%F\*.wav" "e:\wav"

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@iamtekeste
iamtekeste / Ruby Shell Commands
Created February 20, 2014 14:26
Run Shell Commands with Ruby!
#Exec
$ irb
>> exec 'echo "hello $HOSTNAME"'
hello nate.local
$
#System
$ irb
>> system 'echo "hello $HOSTNAME"'
@iamtekeste
iamtekeste / remote desktop
Created February 25, 2014 07:49
Connect to Remote Desktop from terminal ubuntu
rdesktop -u username -g 1024×768 servername
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@iamtekeste
iamtekeste / ruby manual installation
Created March 19, 2014 12:36
Ruby Requirements Manual Installation
Try running sudo apt-get update separately on a command line. Your Ubuntu might be old and its repositories could be out of date. So apt-get update itself is maybe not working in your machine.
To step over that issue, run the following commands:
# Disable RVM from trying to install necessary software via apt-get
rvm autolibs disable
# Then try installing Ruby:
rvm install 1.8.7
@iamtekeste
iamtekeste / current page url
Created March 21, 2014 13:47
Get Current Page URL ~ Laravel
You can use: Request::url() to obtain the current URL, here is an example:
@if(Request::url() === 'your url here')
// code
@endif
Laravel offers a method to find out, whether the URL matches a pattern or not
if (Request::is('admin/*'))
{
// code
@iamtekeste
iamtekeste / page reload alert
Created April 2, 2014 08:32
Alert During Page Reload!
<script type="text/javascript">
window.onbeforeunload = function() {
return "Dude, are you sure you want to leave? Think of the kittens!";
}
</script>
@iamtekeste
iamtekeste / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
$news_term = get_term_by('name', 'news', 'category');
if(!empty($news_term)) {
$news_child_terms = get_categories(array(
'parent' => $news_term->term_id
));