CATF44LT7C-eyJsaWNlbnNlSWQiOiJDQVRGNDRMVDdDIiwibGljZW5zZWVOYW1lIjoiVmxhZGlzbGF2IEtvdmFsZW5rbyIsImFzc2lnbmVlTmFtZSI6IiIsImFzc2lnbmVlRW1haWwiOiIiLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IklJIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiQUMiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJEUE4iLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJQUyIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IkdPIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiRE0iLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJDTCIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJTMCIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJDIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiUkQiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJQQyIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJNIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiV1MiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJEQiIsI
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
============================================================================ | |
#Wireshark installation directory: windows | |
C:\Program Files (x86)\Wireshark>tshark.exe | |
============================================================================ | |
tshark -D #list of available interfaces | |
============================================================================ | |
capture | |
============================================================================ | |
tshark -i 2 #start capturing traffic on interface n°2 | |
tshark -i 2 -a duration:10 #capture for 10 seconds, then stop |
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
function convertMiliseconds(miliseconds, format) { | |
var days, hours, minutes, seconds, total_hours, total_minutes, total_seconds; | |
total_seconds = parseInt(Math.floor(miliseconds / 1000)); | |
total_minutes = parseInt(Math.floor(total_seconds / 60)); | |
total_hours = parseInt(Math.floor(total_minutes / 60)); | |
days = parseInt(Math.floor(total_hours / 24)); | |
seconds = parseInt(total_seconds % 60); | |
minutes = parseInt(total_minutes % 60); |
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
function maxWordsPerLine(str, max = 30) { | |
const result = []; | |
let counter = 1; | |
let tempArr = []; | |
for (const [index, letter] of str.split('').entries()) { | |
if (counter === max + 1) { | |
counter = 1; | |
result.push(tempArr); |
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
if (!Element.prototype.findParentTagName) { | |
Element.prototype.findParentTagName = function (stringData) { | |
try { | |
if (this.tagName.equal(stringData)) return this; | |
let parent = this.parentElement; | |
while (parent) { | |
if (parent.tagName.equal(stringData)) return parent; | |
parent = parent.parentElement; | |
} | |
} catch (e) { |
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
function diff(arr1, arr2) { | |
return arr1.filter(x => arr2.includes(x)); | |
} | |
const arr1 = [ | |
34242, | |
33030, | |
34241, | |
27118, | |
34152, |
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
const { readFile: originalReadFile, writeFile: originalWriteFile } = require('fs') | |
const { promisify } = require('util') | |
const { resolve, join } = require('path') | |
const originalGlob = require('glob') | |
const glob = promisify(originalGlob) | |
const readFile = promisify(originalReadFile) | |
const writeFile = promisify(originalWriteFile) | |
class Storefront { |
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
/** | |
* This method is used to detect the user browser and environment | |
*/ | |
establishBrowser() { | |
const userAgent = (navigator && navigator.userAgent || '').toLowerCase() | |
const vendor = (navigator && navigator.vendor || '').toLowerCase() | |
const comparator = { | |
'<': function(a, b) { return a < b; }, | |
'<=': function(a, b) { return a <= b; }, |
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
<!-- i needed to run webpack from ant build, so this was the solution --> | |
<macrodef name="nodejs"> | |
<attribute name="module" description="The name of the NodeJS module to execute" /> | |
<attribute name="failonerror" default="true" description="Fail if the exit code is not 0" /> | |
<attribute name="dir" description="Directory to execute task" /> | |
<element name="args" implicit="yes" description="Argument to pass to the exec task" /> | |
<sequential> | |
<exec executable="cmd.exe" dir="@{dir}" failonerror="@{failonerror}" osfamily="winnt"> |
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
const sha256 = async message => { | |
const msgBuffer = new TextEncoder('utf-8').encode(message); | |
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer); | |
const hashArray = Array.from(new Uint8Array(hashBuffer)); | |
return hashArray.map(b => ('00' + b.toString(16)).slice(-2)).join(''); | |
} |
NewerOlder