Skip to content

Instantly share code, notes, and snippets.

View merlos's full-sized avatar

merlos merlos

View GitHub Profile
@merlos
merlos / change-title.sh
Created October 24, 2023 08:23
Change the title of a term and get it
#
# to set the title of the current terminal. (tested on OSX, but should work on linux terminal too)
#
echo -e "\033]0;This is my title\a"
#
# To get the title (OSX)
#
title=`osascript -e 'tell application "Terminal" to get name of front window'`
echo $title
@merlos
merlos / adgroups.py
Last active September 18, 2023 11:17
Python script to get all the AD groups from Graph API
import requests
import csv
import msal
import os
"""
Script to save into a file csv file the name of the groups of Active Directory
It requires 3 environment variables
@merlos
merlos / gist:4eaf6e2635cf82456052cbc765d9506c
Created July 13, 2023 06:51
Shell script to convert markdown files to PDF
#!/bin/bash
# TODO improve documentation
OUTPUT_DIR='build'
SKIP_FILES=(README.md Home.md)
# This script exports Markdown files into different formats (HTML, PDF, etc..)
#
@merlos
merlos / DownloadSharepointDocuments.ps1
Created March 13, 2023 06:58
PowerShell script to download all the files of a SharePoint Library
#
# PowerShell script to download the contents of a sharepoint library
#
# Usage:
# .\DownloadSharePointDocuments.ps1 -SiteUrl "https://<tenant-name>.sharepoint.com/sites/yoursite/"
# -LibraryName "Library"
# -DownloadFolder "./LibraryDocuments"
# # DownloadFolder must exist
#
# To run on OSX it is required to have pwsh
@merlos
merlos / .bash_profile
Created April 7, 2020 10:34
Browser in dev mode OSX
echo adding alias chromecors
alias chromecors='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security --disable-gpu --user-data-dir=~/chromeTemp'
#
# Install extension in VSCode
# https://marketplace.visualstudio.com/items?itemName=firefox-devtools.vscode-firefox-debug
#
# Set Firefox Developer Editionto support debug mode
#
# In about:config
@merlos
merlos / GPX File example
Last active August 13, 2022 22:15
Example of GPX file
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="Open GPX Tracker for iOS">
<wpt lat="40.762468446233115" lon="-73.99090283852468">
<time>2019-12-06T14:19:25Z</time>
<name>09:19:25</name>
<desc>Dec 6, 2019 at 09:19:25</desc>
</wpt>
<wpt lat="40.80559910750484" lon="-73.95810627601767">
<time>2019-12-06T14:19:29Z</time>
<name>09:19:29</name>
# Import the tree component
import {Tree} from 'untree-react'
class MyComponent extends React.Component {
constructor() {
//initialize the Tree
this.state.tree = {
name: "Node 1"
@merlos
merlos / SetSharePointCredentials.ps1
Created October 23, 2018 19:24
A PowerShell Script to set credentials as environment variables. Password is not stored as plain text.
# Description
# This Script sets Sharepoint Credentials as environment variables so
# you are not prompted on your script every time
#
# Usage
#
# PS> SetSharepointCredentials
#
# It will prompt the user to type site url, username, password. If it is successful
#
@merlos
merlos / Date+timeAgo.swift
Created September 23, 2018 11:26
Provides a humanised date. For instance: 1 minute, 1 week ago, 3 months ago.
//
// Date+timeAgo.swift
// OpenGpxTracker
//
// Created by merlos on 23/09/2018.
//
// Based on this discussion: https://gist.github.com/minorbug/468790060810e0d29545
//
// If future dates are needed https://gist.github.com/jinthagerman/009c85b7bbd0a40dcbba747e89a501bf
//
@merlos
merlos / topdf.js
Last active August 9, 2018 16:15
Simple phantomJS script to create a PDF from a URL or a HTML file
/**
* Simple script to create a PDF from a URL.
* Usage:
* $ phantomjs topdf.js
*
*/
var page = require('webpage').create();