Skip to content

Instantly share code, notes, and snippets.

@nicolae-olariu
nicolae-olariu / .htaccess
Created February 21, 2017 21:30 — forked from jentanbernardus/.htaccess
.htaccess Rules for Better Google Page Speed Results - Here's a set of default rules that I add to any site that I want to significantly increase the speed of. It took a lot of weeding through and testing, but this seems to work the best and will (guarantee not included) increase your Google Page Speed score by taking care of a lot of the cache …
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
# Set up caching on media files for 1 year (forever?)
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A29030400
Header append Cache-Control "public"
</FilesMatch>
@nicolae-olariu
nicolae-olariu / gist:2fa90204ab5cc1c68846c54688068342
Created March 7, 2017 08:36
Get latest commit over the entire git repo
git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short)--%(authorname)--%(committerdate)' | head -n1
@nicolae-olariu
nicolae-olariu / branch-count.sh
Created October 10, 2017 11:35 — forked from rwaldron/branch-count.sh
Count number of branches in a repo
git branch | wc -l
@nicolae-olariu
nicolae-olariu / bash-smtp-auth-email
Created November 24, 2017 12:17 — forked from fbatschi/bash-smtp-auth-email
How to send an email from bash via SMTP Auth
echo "PUT YOUR MAIL BODY HERE" | mailx -s "SUBJECT" -S smtp=smtp://yoursmtpserver.com -S smtp-auth=login -S smtp-auth-user=YOUR_USERNAME -S smtp-auth-password=YOUR_PASSWORD -S from="Sender Name <[email protected]>" [email protected]
@nicolae-olariu
nicolae-olariu / test.sh
Created December 21, 2017 10:42
bash: bulk test redirects
Based on (this answer)[https://stackoverflow.com/a/28100010/2674883]:
One solution :
csv:
http://google.com;http://www.google.fr
http://domain.null;http://www.domain.null
code:
@nicolae-olariu
nicolae-olariu / flush-dns.sh
Created January 30, 2018 10:00 — forked from craigvantonder/flush-dns.sh
Flushing the DNS in Ubuntu 16.04
#!/bin/bash
# NB: First install nscd with sudo apt-get install nscd
# run this command to flush dns cache:
sudo /etc/init.d/dns-clean restart
# or use:
sudo /etc/init.d/networking force-reload
# Flush nscd dns cache:
sudo /etc/init.d/nscd restart
@nicolae-olariu
nicolae-olariu / git_create_orphan.sh
Created January 9, 2019 07:33 — forked from seanbuscay/git_create_orphan.sh
Create an orphan branch in a repo.
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name
@nicolae-olariu
nicolae-olariu / find files by extension
Created July 16, 2019 10:04
find all html files but exclude index.html, then delete all files found
find src -name "*.html" -not -path "src/index.html" -delete
@nicolae-olariu
nicolae-olariu / gist:8935e524752367be09d820ba5f0784eb
Created July 16, 2019 10:05
delete all files from git that were previously physically deleted
git ls-files --deleted -z | xargs -0 git rm
@nicolae-olariu
nicolae-olariu / Observable_in_vanillaJS.md
Created October 30, 2019 09:14 — forked from ltciro/Observable_in_vanillaJS.md
simulate pattern observable in vanilla JS

Rxjs

const next = (message)=> console.log("First observer message: " + message);
const error = (error) => console.log("Second observer error: " + error);
const complete = () => console.log("complete");

const next1 = (message)=> console.log("First observer message 1: " + message);
const error1 = (error) => console.log("Second observer error 1: " + error);
const complete1 = () => console.log("complete 1");