Skip to content

Instantly share code, notes, and snippets.

View airflow-use-text-for-table-names.py
#This code is an example of how to use text based mapper class names to query the airflow db.
import inspect
import re
from airflow.models.base import Base
from airflow import DAG, settings
from airflow.operators.python import PythonOperator
from airflow.utils.dates import days_ago
View git-most-changed-files-lastyear.ps1
#based on: https://www.therealomar.com/articles/2019-06/Git-the-most-edited-files-in-a-project
git log --pretty=format: --name-only --since=1.years.ago |
Where-Object { ![string]::IsNullOrEmpty($_) } |
Group-Object |
Sort-Object -Property Count -Descending |
Select-Object -Property Count, Name -First 10
View vscode-custom-task-aws-validate-cloudformation-template.json
//validates a cloud formation template in VsCode.
//add this to a file named tasks.json in the .vscode folder.
//to run: Terminal >> Run Task...
{
"version": "2.0.0",
"tasks":[
{
"label":"aws cf validate-template",
"type":"shell",
"presentation": {
View vscode-python-debug-specific-file-launch.json
//Add the following launch configuration to launch.json. I create
//a specific launch.json in my workspace folder as this setting
//will likely be different for each workspace folder.
//change the "startupFileNameHere" to point to your startup file.
"configurations": [
{
"name": "Python: Run Startup File",
"type": "python",
"request": "launch",
View gitlens.remotes.aws.md
@rajrao
rajrao / OdataQueryD365FinanceAndOperationsTest.cs
Last active Sep 14, 2020
Shows how to perform authentication and retrieval of data from D365 Finance and Operations using OData and the Service to service calls using client credentials
View OdataQueryD365FinanceAndOperationsTest.cs
//more details at: https://blog.aggregatedintelligence.com/2020/09/d365-finance-and-operations-odata-query.html
var baseUrl = "https://myDomain.sandbox.operations.dynamics.com"; //a trailing slash here will cause a "No P3P Policy defined" error
var tenantId = "TENANTID AS A GUID HERE";
string applicationId = "APPLICATION GUID HERE";
string clientSecret = "CLIENT SECRET HERE";
string api = "data/";
var authorityUrl = $"https://login.windows.net/{tenantId}";
@rajrao
rajrao / lz77.cs
Created Jul 4, 2020 — forked from mjs3339/lz77.cs
C# Implementation LZ77 Compression Algorithm
View lz77.cs
public static class Lz77
{
private const int RingBufferSize = 4096;
private const int UpperMatchLength = 18;
private const int LowerMatchLength = 2;
private const int None = RingBufferSize;
private static readonly int[] Parent = new int[RingBufferSize + 1];
private static readonly int[] LeftChild = new int[RingBufferSize + 1];
private static readonly int[] RightChild = new int[RingBufferSize + 257];
private static readonly ushort[] Buffer = new ushort[RingBufferSize + UpperMatchLength - 1];
@rajrao
rajrao / button.py
Created Aug 1, 2016 — forked from ecaron/button.py
Python script for listening to Raspberry Pi button push
View button.py
import requests
import time
import RPi.GPIO as GPIO
url = 'http://nightlight/' # I map this to my internal DNS hosting the node app
gpio_pin=18 # The GPIO pin the button is attached to
longpress_threshold=5 # If button is held this length of time, tells system to leave light on
GPIO.setmode(GPIO.BCM)
GPIO.setup(gpio_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)