Skip to content

Instantly share code, notes, and snippets.

View phantomtnt's full-sized avatar

Juansei phantomtnt

View GitHub Profile
@phantomtnt
phantomtnt / screenshotCaptureStream.js
Last active October 27, 2023 15:34
[Screenshot page as image] Script to make a screenshot of a webpage #Javascript
/*
Source:
https://hackernoon.com/how-to-take-screenshots-in-the-browser-using-javascript-l92k3xq7
It needs permission from uses to access display
*/
const capture = async () => {
@phantomtnt
phantomtnt / archive-website-wget-wordpress.bash
Created November 2, 2022 15:12
Archiving a (WordPress) website with wget
## From:
## https://darcynorman.net/2011/12/24/archiving-a-wordpress-website-with-wget/
# I needed to archive several WordPress sites as part of the process of gathering the raw data for my thesis research. I found a few recipes online for using wget to grab entire sites, but they all needed some tweaking. So, here's my recipe for posterity:
# I used wget, which is available on any linux-ish system (I ran it on the same Ubuntu server that hosts the sites).
wget --mirror -p --html-extension --convert-links -e robots=off -P . http://url-to-site
# That command doesn't throttle the requests, so it could cause problems if the server has high load. Here's what that line does:
@phantomtnt
phantomtnt / autoScroll.js
Last active September 16, 2019 20:09
[Autoscroll page] Function that autoscroll the page, perfect for help to capture a webpage scroll preview in a browser viewport #Javascript #Helpers
//Define page scroll function
function pageScroll() {
window.scrollBy(0, 2);
scrolldelay = setTimeout(pageScroll, 10);
}
//Execute page scroll function
pageScroll()
@phantomtnt
phantomtnt / Bash-basics.md
Last active February 14, 2021 20:25
[Bash Basics] Basic commands and tools for shell #Bash

ORIGINAL ARTICLE https://dev.to/awwsmm/101-bash-commands-and-tips-for-beginners-to-experts-30je

Update 8 July 2019: I recently found this very similar article posted to a French-language message board about two years ago. If you're interested in learning some shell commands -- and you parler français, it's a great supplement to my article, below.

Until about a year ago, I worked almost exclusively within the macOS and Ubuntu operating systems. On both of those OSes, bash is my default shell. I've acquired a general understanding of how bash works over the past six or seven years and would like to give an overview of some of the more common / useful commands for those just getting started. If you think you know everything there is to know about bash, take a look below anyway -- I've included some tips and reminders of flags you may have forgotten about, which could mak

@phantomtnt
phantomtnt / getSpPermission.ps1
Last active May 28, 2019 19:36
[Get SharePoint Permissions] Get Permission report of sharepoint site in CSV #SharePoint #PowerShell
$siteUrl = "http://localhost:2518"
$site = Get-SPWeb $siteUrl
$currentPath = Get-Location
$report = Get-SPPermissionsReport($site)
$report | Sort-Object "Url" | Export-Csv -NoTypeInformation -delimiter "," -path "$currentPath\reporte.csv"
@phantomtnt
phantomtnt / SharePointNitCOL.md
Last active August 16, 2019 20:56
[Validacion columna NIT] Validación de columna SharePoint para NIT Colombia fomato: XXX.XXX.XXX-X #SharePoint

##Notas

NIT es el nombre de la columna de sharepoint

Primero se valida el total de caracteres necesarios en este caso 13. => (LEN)=13

Se valida si el 4 cáracter de la cadena es igual a "." punto => (MID(NIT;4;1)=".")

Se valida si el caracter es un número se usa funcion CODE para obtener número de caracter hexadecimal entre 47 y 58 correspondientes a valores entre 0 y 9

Se concatenan valores de true hasta obtener un total de 24 que es el número de validaciones verdaderas

@phantomtnt
phantomtnt / isEditMode.js
Last active April 25, 2024 17:53
Check if a Sharepoint classic page Is in edit mode #SharePoint #Helpers
var inEditMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;
if (inEditMode == "1")
{
// page is in edit mode
}
else
{
// page is in browse mode
}