Skip to content

Instantly share code, notes, and snippets.

View Trippnology's full-sized avatar

Trippnology Trippnology

View GitHub Profile
@Trippnology
Trippnology / gist:4569601
Created January 18, 2013 23:35
Shell: ASCII border
box() { t="$1xxxx";c=${2:-=}; echo ${t//?/$c}; echo "$c $1 $c"; echo ${t//?/$c}; }
@Trippnology
Trippnology / .htaccess
Created February 25, 2013 14:49
Apache: 5G Blacklist 2013 (for .htaccess)
# 5G BLACKLIST/FIREWALL (2013)
# @ http://perishablepress.com/5g-blacklist-2013/
# 5G:[QUERY STRINGS]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} (\"|%22).*(<|>|%3) [NC,OR]
RewriteCond %{QUERY_STRING} (javascript:).*(\;) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3) [NC,OR]
@Trippnology
Trippnology / .editorconfig
Last active December 15, 2015 06:39
Editor Config
# editorconfig.org
root = true
[*]
indent_style = tab
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@Trippnology
Trippnology / gist:5280633
Created March 31, 2013 13:47
Windows: Run anything as a service
sc create shortname binpath= "\"C:\Path\To\Your\program.exe\" --your-program-options" displayname= "Full Name of Service for Service Manager" start= auto
@Trippnology
Trippnology / Git Cheat Sheet.md
Last active October 24, 2018 11:31
Git: Cheat Sheet
@Trippnology
Trippnology / cut-the-mustard.js
Created May 16, 2013 19:51
JS: BBC "Cutting the mustard" test
// http://responsivenews.co.uk/post/18948466399/cutting-the-mustard
if('querySelector' in document
&& 'localStorage' in window
&& 'addEventListener' in window) {
// bootstrap the javascript application
}
@Trippnology
Trippnology / gist:5671947
Created May 29, 2013 17:06
Facebook like button that validates. Now outdated, see http://developers.facebook.com/docs/reference/plugins/like/
<script type="text/javascript">
//<![CDATA[
(function() {
document.write('<fb:like width="200"></fb:like>');
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://connect.facebook.net/en_US/all.js#xfbml=1';
s1.parentNode.insertBefore(s, s1);
})();
@Trippnology
Trippnology / gist:5676581
Created May 30, 2013 08:47
Blogger dynamic views jump menu
<script>
function openDir( form ) {
var newIndex = form.blogviewselect.selectedIndex;
if ( newIndex == 0 ) {
alert( "Please select a view" );
}
else {
cururl = form.blogviewselect.options[ newIndex ].value;
window.location.assign( cururl );
}
@Trippnology
Trippnology / Fade-off-the-bottom-of-an-image.markdown
Created October 18, 2013 12:45
CSS: Fade off the bottom of an image

Fade off the bottom of an image

This looks like a good way to limit the height of a dynamic image (perhaps user submitted).

A Pen by Trippnology on CodePen.

License.

@Trippnology
Trippnology / linux-tips-and-tricks.txt
Created November 15, 2013 13:19
Linux: Tips and Tricks
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
BASH
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command < file.in' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
'ls docs; ^docs^web^' is equal to 'ls web'. The second argument can be empty.
* '!!:n' selects the nth argument of the last command, and '!$' the last arg