Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / .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 / clipboard-copy.js
Created March 9, 2016 13:25
add read more at address clipboard
function addLink(event) {
event.preventDefault();
var pagelink = '\n\n Read more at: ' + document.location.href,
copytext = window.getSelection() + pagelink;
if (window.clipboardData) {
window.clipboardData.setData('Text', copytext);
}
}
@nicolae-olariu
nicolae-olariu / _decimal.scss
Created December 22, 2015 11:09 — forked from terkel/_decimal.scss
Rounding decimals in Sass
// _decimal.scss | MIT License | gist.github.com/terkel/4373420
// Round a number to specified digits.
//
// @param {Number} $number A number to round
// @param {Number} [$digits:0] Digits to output
// @param {String} [$mode:round] (round|ceil|floor) How to round a number
// @return {Number} A rounded number
// @example
// decimal-round(0.333) => 0
@nicolae-olariu
nicolae-olariu / gist:b948fd7d51d56ecebfc9
Created December 16, 2015 09:17
Ignore files from gitignore that were previously versioned
git rm --cached <file>
@nicolae-olariu
nicolae-olariu / gist:e81177a945b49cae2999
Created November 19, 2015 09:44 — forked from AndreasMadsen/gist:2693051
base64 shim [atob, btoa]
// Source: http://code.google.com/p/gflot/source/browse/trunk/flot/base64.js?r=153
/* Copyright (C) 1999 Masanao Izumo <[email protected]>
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
*/
/*
* Interfaces:
@nicolae-olariu
nicolae-olariu / Fix node path
Created November 16, 2015 09:17
Fixing /usr/bin/env: node: No such file or directory issue
sudo ln -fs /usr/bin/nodejs /usr/local/bin/node