Skip to content

Instantly share code, notes, and snippets.

View guillermoroblesjr's full-sized avatar

Guillermo Robles, Jr. guillermoroblesjr

View GitHub Profile
@guillermoroblesjr
guillermoroblesjr / gist:6dd1a9c6f0f9e00fece8
Created February 19, 2015 22:32
get a list of ssh sessions running
# get a list of ssh sessions running
sudo ss -lnp | grep sshd
@guillermoroblesjr
guillermoroblesjr / gist:2d405b05d897d1b6cce7
Last active August 29, 2015 14:15
Searching/Finding phrases within files with GREP
# -r searches directories and subdirectories
# -l display only file names
# -i case insensitive
grep -r -l -i "findme" ./here/
# -in display line numbers
grep -r -i -in "findme" ./here/
@guillermoroblesjr
guillermoroblesjr / gist:c5a7519b1c74adb41286
Last active August 29, 2015 14:15
Copy files over SSH with scp
# ===[ Secure Copy (via ssh) ]===
#Copy the file "foobar.txt" from a remote host to the local host
scp [email protected]:foobar.txt /some/local/directory
#Copy the file "foobar.txt" from the local host to a remote host
scp foobar.txt [email protected]:/some/remote/directory
@guillermoroblesjr
guillermoroblesjr / gist:4cd22315bb75da55cbfb
Last active August 29, 2015 14:15
Terminal deleting/removing a directory
# remove directory
rm -rf <name-of-directory>
# Windows, remove directory using robocopy
robocopy "a_empty_dir" <dir-to-delete> /MIR
@guillermoroblesjr
guillermoroblesjr / gist:6b5f3fa21471cd07d45b
Last active August 29, 2015 14:15
7z Compression in the Terminal
# ===[ Compression/7z ]===
# make a 7z archive file out of a directory
# a: add to archive
# -t7z: use 7z file type
# -mx5:
# -mmt: multithread the operation
7z a -t7z <name-of-new-file>.7z <directory-to-be-compressed> -mx5 -mmt
# extract
@guillermoroblesjr
guillermoroblesjr / gist:d519e64a0d3d3456ebed
Last active August 29, 2015 14:15
Fast 'for' JS Looping
var arr = [1,2,3,4,5];
for (var i = 0, len = arr.length; i < len; i++) {
(function(i){
console.log(arr[i]);
})(i);
};