Skip to content

Instantly share code, notes, and snippets.

View matinrco's full-sized avatar
🤔

Matin matinrco

🤔
View GitHub Profile
@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="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@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 / 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 / fixPermissions.sh
Created July 12, 2018 07:49
Fix file & folders permissions - git repo , e.g.
# For directories :
find . -type d -exec chmod 755 {} \;
# For files :
find . -type f -exec chmod 644 {} \;
@matinrco
matinrco / nginx-cloudflare.conf
Created July 7, 2018 11:42
Sample nginx configuration when using cloudflare with ssl & nginx proxy pass
server {
listen 80;
server_name example.com;
if ($http_x_forwarded_proto = "http") {
return 301 https://$server_name$request_uri;
}
location / {
@matinrco
matinrco / letsencryptHowTo-DNSValidation.sh
Created July 3, 2018 09:48
Let’s Encrypt - issue certificates with certbot-auto and renew how to - with DNS TXT domain validation
#this file is not ready for execution
#go to /opt to download certbot-auto
cd /opt
wget https://dl.eff.org/certbot-auto
#correct permissions
chmod a+x certbot-auto
@matinrco
matinrco / dockerHttpProxyOnLinux.md
Last active June 25, 2018 12:58
docker http proxy on linux

create a systemd drop-in directory for the docker service:

mkdir /etc/systemd/system/docker.service.d

Now create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable: [Service] Environment="HTTP_PROXY=http://proxy.example.com:80/"

@matinrco
matinrco / curlSocksProxy
Created June 25, 2018 11:27
curl socks proxy
#inline socks usage with curl E.g :
curl --socks5-hostname 192.X.X.X:9050 -sSL https://example.com
#you can create .curlrc with following content :
socks5-hostname 192.X.X.X:9050
@matinrco
matinrco / 12proxy
Created June 25, 2018 10:42
Debian apt http proxy - save this config in /etc/apt/apt.conf.d/
Acquire::http::proxy "http://127.0.0.1:8118/";
Acquire::https::proxy "https://127.0.0.1:8118/";