Skip to content

Instantly share code, notes, and snippets.

View sebastianherman's full-sized avatar

Sebastian Herman sebastianherman

View GitHub Profile
@sebastianherman
sebastianherman / sol.js
Last active January 9, 2021 13:11
Functional Programming: Apply Functional Programming to Convert Strings to URL Slugs - freeCodeCamp solution
function urlSlug(title) {
return title.split(/\W/).filter(item => item).map(item => item.toLowerCase()).join("-")
}
@sebastianherman
sebastianherman / sol.js
Created January 9, 2021 14:28
Intermediate Algorithm Scripting: Diff Two Arrays - freeCodeCamp solution
function diffArray(arr1, arr2) {
let newArr1 = arr1.filter(val => {
return arr2.indexOf(val) == -1;
})
let newArr2 = arr2.filter(val => {
return arr1.indexOf(val) == -1;
})
return newArr1.concat(newArr2);
}
@sebastianherman
sebastianherman / sol.js
Created January 10, 2021 14:00
Intermediate Algorithm Scripting: Missing letters - freeCodeCamp solution
function fearNotLetter(str) {
let letters = str.split("");
let alph = 'abcdefghijklmnopqrstuvwxyz'.split("");
let range = alph.slice(alph.indexOf(letters[0]), alph.indexOf(letters[0])+letters.length+1);
console.log("Original range: " + range);
for (let i in str) {
@sebastianherman
sebastianherman / sol.js
Created January 10, 2021 14:15
Intermediate Algorithm Scripting: Sorted Union - freeCodeCamp solution
function uniteUnique(arr) {
let newArr = [];
for (let i=0; i<arguments.length; i++) {
for (let j=0; j<arguments[i].length; j++) {
if (!newArr.includes(arguments[i][j])) {
newArr.push(arguments[i][j]);
}
}
@sebastianherman
sebastianherman / sol.js
Created January 10, 2021 14:27
Intermediate Algorithm Scripting: Convert HTML Entities - freeCodeCamp solution
function convertHTML(str) {
let signs = {'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'\"': '&quot;',
'\'': '&apos;'};
let signKeys = Object.keys(signs);
console.log(signKeys);
@sebastianherman
sebastianherman / sol.js
Created January 10, 2021 15:21
Intermediate Algorithm Scripting: Sum All Primes - freeCodeCamp solution
function sumPrimes(num) {
let sum = 0;
const isPrime = n => ![...Array(n).keys()].slice(2).map(i => !(n%i)).includes(true) && ![0,1].includes(n)
for (let i=0; i<=num; i++) {
if (isPrime(i)) {
sum += i;
}
@sebastianherman
sebastianherman / sol.js
Created January 10, 2021 15:41
Intermediate Algorithm Scripting: Binary Agents - freeCodeCamp solution
function binaryAgent(str) {
return str.split(" ").map(value => {
return String.fromCharCode(parseInt(value, 2));
}).join("");
}
@sebastianherman
sebastianherman / sol.js
Created January 10, 2021 15:57
Intermediate Algorithm Scripting: Everything Be True - freeCodeCamp solution
function truthCheck(collection, pre) {
for (let i in collection) {
if (collection[i].hasOwnProperty(pre)) {
if(!collection[i][pre]) {
return false;
}
} else if (!collection[i].hasOwnProperty(pre)) {
return false;
}
}
@sebastianherman
sebastianherman / PowerView-3.0-tricks.ps1
Created February 22, 2023 14:33 — forked from HarmJ0y/PowerView-3.0-tricks.ps1
PowerView-3.0 tips and tricks
# PowerView's last major overhaul is detailed here: http://www.harmj0y.net/blog/powershell/make-powerview-great-again/
# tricks for the 'old' PowerView are at https://gist.github.com/HarmJ0y/3328d954607d71362e3c
# the most up-to-date version of PowerView will always be in the dev branch of PowerSploit:
# https://github.com/PowerShellMafia/PowerSploit/blob/dev/Recon/PowerView.ps1
# New function naming schema:
# Verbs:
# Get : retrieve full raw data sets
# Find : ‘find’ specific data entries in a data set