Skip to content

Instantly share code, notes, and snippets.

View magnetikonline's full-sized avatar
💡
I have an idea!

Peter Mescalchin magnetikonline

💡
I have an idea!
View GitHub Profile
@magnetikonline
magnetikonline / gist:4386671
Last active December 10, 2015 05:18
Webalizer IgnoreAgent/SearchEngine rule sets conf - 2012-12
IgnoreAgent Aboundex/*
IgnoreAgent AdsBot-Google*
IgnoreAgent Aghaven/*
IgnoreAgent Alltop/*
IgnoreAgent AppEngine-Google*
IgnoreAgent Apple-PubSub/*
IgnoreAgent AppleSyndication/*
IgnoreAgent BacklinkCrawler*
IgnoreAgent Baiduspider*
IgnoreAgent bitlybot
@magnetikonline
magnetikonline / README.md
Last active September 1, 2023 00:41
Bookmarklet to pretty print Gist pages without the usual page chrome, just content.

Pretty print bookmarklet helper for Gist pages

Create a new bookmark somewhere handy in your browser with the following URL:

javascript:var el=document.createElement('style');el.media='print';el.innerHTML='#header,.pagehead.repohead,.gist-description.container,.file-box .meta,#comments,.js-comment-form,#footer{display:none;}.file-box{border:0!important;}';document.getElementsByTagName('head')[0].appendChild(el);alert('Please consider the environment before printing :)');
  • Navigate to your Gist of choice
  • Hit the bookmarklet
@magnetikonline
magnetikonline / magentodenynginx.conf
Last active December 12, 2015 07:18
Magento Nginx default deny ruleset.
# a fairly complete set of deny rules for Magento when running under Nginx webserver
# replicating functionality from the .htaccess files present in a base install.
location ~ "\.htaccess$" {
deny all;
}
location ^~ /app/ {
deny all;
}
@magnetikonline
magnetikonline / filelistandcount.sh
Last active December 12, 2015 09:09
Find and list all file types recursively from the current directory with file counts.
find . -type f | sed 's/.*\.//' | sort | uniq -c
@magnetikonline
magnetikonline / README.md
Last active August 9, 2017 21:53
Creating a remote Git repository.
@magnetikonline
magnetikonline / README.md
Last active November 22, 2018 15:05
Subversion (SVN) to Git repository conversion notes.
@magnetikonline
magnetikonline / gittruncatehistory.sh
Last active February 27, 2020 22:29
Truncate Git history to after specific SHA1, dropping everything at and before it.
#!/bin/bash -e
# Inspired by: https://github.com/adrienthebo/git-tools/blob/master/git-truncate
if [[ (-z $1) || (-z $2) ]]; then
echo "Usage: $(basename "$0") DROP_AT_SHA1 BRANCH"
exit 1
fi
if [[ ! $1 =~ ^[0-9a-f]{7,40}$ ]]; then
echo "Error: invalid Git commit SHA1" >&2
@magnetikonline
magnetikonline / example.scss
Last active December 14, 2015 09:09
Sass media query @mixin example.
$breakSmall: 320px;
$breakLarge: 1024px;
@mixin respondTo($media) {
@if ($media == handhelds) {
@media only screen and (max-width: $breakSmall) { @content; }
}
@else if ($media == medium-screens) {
@media only screen and (min-width: $breakSmall + 1) and (max-width: $breakLarge - 1) { @content; }
}
@magnetikonline
magnetikonline / precompresscssjswebfont.sh
Last active July 1, 2022 04:47
Recursively pre-compress (gzip) CSS/JavaScript/webfont assets for use Nginx and its HttpGzipStaticModule module.
#!/bin/bash -e
function compressResource {
gzip --best --stdout "$1" >"$1.gz"
touch --no-create --reference="$1" "$1.gz"
echo "Compressed: $1 > $1.gz"
}
function main {
@magnetikonline
magnetikonline / .screenrc
Last active December 14, 2015 19:58
Some GNU Screen .screenrc stuff.
caption always "%{= kw}%-w%{= rw}%n %t%{-}%+w %-="
defscrollback 30000
escape ^Aa
vbell off