Skip to content

Instantly share code, notes, and snippets.

View marekcech's full-sized avatar

Marek Čech marekcech

View GitHub Profile
{
"name": "Security testing",
"icon": "security",
"children": [
{
"name": "Penetration Testing 2",
"icon": "penetration_testing",
"children" : [
{
"name": "Exploitation",
@marekcech
marekcech / ISO-timezone-with-offset.js
Created November 11, 2017 18:28
returns ISO timezone with offset
function() {
// Get local time as ISO string with offset at the end
var now = new Date();
var tzo = -now.getTimezoneOffset();
var dif = tzo >= 0 ? '+' : '-';
var pad = function(num) {
var norm = Math.abs(Math.floor(num));
return (norm < 10 ? '0' : '') + norm;
};
return now.getFullYear()
@marekcech
marekcech / random-ID.js
Last active November 11, 2017 18:25
Piece of JS which generates random-ID with lenght 10 symbols
function() {
return new Date().getTime() + '.' + Math.random().toString(36).substring(10);
}
// node.js
function() {
return new Date().now() + '.' + Math.random().toString(36).substring(5);
}
@marekcech
marekcech / gtag.js
Last active November 9, 2017 14:15
gtag.js new standard in Google measurement
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('config', 'GA_TRACKING_ID');
</script>