Skip to content

Instantly share code, notes, and snippets.

View matinrco's full-sized avatar
🤔
Thinkering... 😁

Matin matinrco

🤔
Thinkering... 😁
View GitHub Profile
@matinrco
matinrco / editLastWriteTime.ps1
Created November 13, 2018 15:45
Edit file last modified date from powershell
powershell "Get-ChildItem | % {$_.LastWriteTime = '01/01/1993 12:00:00'}"
@matinrco
matinrco / mountOpenVMToolsSharedFolders.md
Last active January 11, 2019 12:07
Mount open-vm-tools shared folders in guest

Mount locally

vmhgfs-fuse .host:/$(vmware-hgfsclient) ~/some_mountpoint

Mount globally

sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other

Mount globally & persistent

Add the following line to your /etc/fstab :
.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other 0 0

@matinrco
matinrco / changingGitAuthorInfo.sh
Created April 7, 2019 10:48
Change git author/committer fields in all previous commits
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@matinrco
matinrco / openconnect.sh
Created April 12, 2019 12:01
Establish VPN connection with Openconnect on linux
echo YourPass | sudo openconnect -u YourUsername --authgroup=DEFAULT -b --passwd-on-stdin --cafile=/path/to/ca.crt --servercert=YourServerCert --pfs Server:Port
@matinrco
matinrco / updateAndCleanImages.sh
Created April 29, 2019 12:45
Update all docker images then remove all untagged images
#!/bin/zsh
####################################################
## Notice : use for development environment only. ##
####################################################
#Update all images
docker images --format "{{.Repository}}:{{.Tag}}" | grep -v "<none>" | xargs -L1 docker pull
@matinrco
matinrco / async_await.js
Last active May 13, 2019 10:45
Sample javascript / nodejs / ecma6 async & await
const asyncAction = ( name )=>{
return new Promise(( resolve , reject )=>{
setTimeout(()=>{
resolve("kk , promise resolved "+ name +" !");
//reject("rejected")
},3000);
});
};
(async ()=>{
@matinrco
matinrco / DockerWindowsBinaries.url
Created May 24, 2019 11:50
Docker windows binaries
https://go.microsoft.com/fwlink/?LinkID=825636&clcid=0x409
@matinrco
matinrco / VMwareWorkstationDHCP.md
Created May 24, 2019 22:49
VMware Workstation DHCP ip address splitting paradigm

Address Use on a Host-Only Network

Range Address use Example
<net>.1 Host machine 192.168.0.1
<net>.2-<net>.127 Static addresses 192.168.0.2-192.168.0.127
<net>.128-<net>.253 DHCP-assigned 192.168.0.128-192.168.0.253
<net>.254 DHCP server 192.168.0.254
<net>.255 Broadcasting 192.168.0.255
@matinrco
matinrco / ip.sh
Last active September 8, 2019 13:49
ip - commands that I use most
# View all network interfaces
ip a
# View all interfaces traffic-volume
ip -s link show
# Find your gateway IP
ip route
ip route | grep default
@matinrco
matinrco / GitPermissions.sh
Created June 14, 2019 14:59
Change file permissions when working with git repo’s
# check the existing permissions , the command will show you the current file permissions like 100644
git ls-files --stage
# update the file permission
git update-index --chmod=+x 'name-of-shell-script'
# check-in the files
git commit -m "Made a file executable"