Skip to content

Instantly share code, notes, and snippets.

View pblocz's full-sized avatar

Pablo Cabeza García pblocz

  • Elastacloud
  • London
View GitHub Profile
@mdrakiburrahman
mdrakiburrahman / query-purview-insights.py
Last active July 30, 2024 08:28
Querying various Azure Purview REST APIs to gather Insights data into Pandas DataFrames
import os
import requests
import json
import jmespath
import pandas as pd
from pprint import pprint
def azuread_auth(tenant_id: str, client_id: str, client_secret: str, resource_url: str):
"""
Authenticates Service Principal to the provided Resource URL, and returns the OAuth Access Token
#! /bin/bash
# Usage:
# ./git-move.sh path/to/file/or/dir path/to/destination/repo
echo "creating patch for path ${1}"
git log --name-only --pretty="format:" --follow "${1}" \
| sort -u | \
xargs git log --pretty=email --patch-with-stat --reverse --full-index --binary -m --first-parent -- > "${2}/_patch_" \
&& echo "moving to destination repo at ${2}" \
&& cd "${2}" \
&& echo "applying patch" \
@pblocz
pblocz / ELPRank.user.js
Last active December 11, 2019 21:53
Tampermonkey script to find UCM ELP Sakai forums posts ranking, use from *forums* tab, or else it won't work
/*! ELPRank.user.js v1.3 | (c) 2014 Pablo Cabeza
* license: http://opensource.org/licenses/mit-license.php
*/
// ==UserScript==
// @name ELPRank
// @namespace https://gist.github.com/43dc185975386ab5eedf
// @version 1.3
// @description To find UCM ELP Sakai forum posts ranking, use from *forums* tab, or else it won't work
// @author Pablo Cabeza
@CrookedNumber
CrookedNumber / gist:8964442
Created February 12, 2014 21:02
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

@minrk
minrk / nbstripout
Last active June 6, 2023 06:23
git pre-commit hook for stripping output from IPython notebooks
#!/usr/bin/env python
"""strip outputs from an IPython Notebook
Opens a notebook, strips its output, and writes the outputless version to the original file.
Useful mainly as a git filter or pre-commit hook for users who don't want to track output in VCS.
This does mostly the same thing as the `Clear All Output` command in the notebook UI.
LICENSE: Public Domain