This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2013 Thom Seddon | |
* Copyright (c) 2010 Google | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#=================================================================================== | |
# | |
# FILE: dump.sh | |
# USAGE: dump.sh [-i interface] [tcpdump-parameters] | |
# DESCRIPTION: tcpdump on any interface and add the prefix [Interace:xy] in front of the dump data. | |
# OPTIONS: same as tcpdump | |
# REQUIREMENTS: tcpdump, sed, ifconfig, kill, awk, grep, posix regex matching | |
# BUGS: --- | |
# FIXED: - In 1.0 The parameter -w would not work without -i parameter as multiple tcpdumps are started. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.filter('bytes', function() { | |
return function(bytes, precision) { | |
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-'; | |
if (typeof precision === 'undefined') precision = 1; | |
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'], | |
number = Math.floor(Math.log(bytes) / Math.log(1024)); | |
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number]; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
<?php | |
echo $this->Paginator->counter(array( | |
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}') | |
)); | |
?> | |
</p> | |
<ul class="pagination"> | |
<?php | |
echo $this->Paginator->prev('«', array('tag' => 'li', 'escape' => false), '<a href="#">«</a>', array('class' => 'prev disabled', 'tag' => 'li', 'escape' => false)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#=================================================================================== | |
# | |
# FILE: dump.sh | |
# USAGE: dump.sh [-i interface] [tcpdump-parameters] | |
# DESCRIPTION: tcpdump on any interface and add the prefix [Interace:xy] in front of the dump data. | |
# OPTIONS: same as tcpdump | |
# REQUIREMENTS: tcpdump, sed, ifconfig, kill, awk, grep, posix regex matching | |
# BUGS: --- | |
# FIXED: - In 1.0 The parameter -w would not work without -i parameter as multiple tcpdumps are started. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var confirm1 = () => { document.querySelectorAll('.uiLayer:not(.hidden_elem) .uiContextualLayer li')[3].click(); } | |
var confirm2 = () => { document.querySelectorAll('.uiLayer:not(.hidden_elem) .layerConfirm')[0].click() } | |
document.querySelectorAll('a[data-tooltip-content="Your friends"]').forEach(function (e, i) { setTimeout(() => { e.click(); setTimeout(confirm1, 1000); setTimeout(confirm2, 2000); }, 3000 * i); }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string as _string | |
from random import SystemRandom as _SystemRandom | |
_saltchars = _string.ascii_letters + _string.digits + './' | |
_sr = _SystemRandom() | |
# SHA512 mksalt extracted from https://github.com/python/cpython/blob/master/Lib/crypt.py | |
def mksalt(): | |
return '$6$' + ''.join(_sr.choice(_saltchars) for char in range(16)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('test', []) | |
.directive('placeholder', function($timeout){ | |
var i = document.createElement('input'); | |
if ('placeholder' in i) { | |
return {} | |
} | |
return { | |
link: function(scope, elm, attrs){ | |
if (attrs.type === 'password') { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright 2013-present Thom Seddon | |
if [ "$1" == "" ]; then | |
echo "Usage: sudo ./mkcrt <hostname>" | |
exit 1 | |
fi | |
if [ "$(id -u)" != "0" ]; then | |
echo "Must run with sudo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Read vars | |
if [ "$1" == "" ]; then | |
echo "Usage: ./git_deploy <folder> <user?> <post-receive?>" | |
exit 1 | |
fi | |
folder=$1 | |
if [ -d "$folder" ]; then |
NewerOlder