This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ProgressBar = require("progress"); | |
const fs = require("fs"); | |
const DOG_ACCESS_FILTER = { | |
epiFindPropertyName: "DogAccess", | |
selectedValue: "true", | |
fieldId: 1153495591, | |
}; | |
const NZ_REGIONS = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const prettier = require('prettier'); | |
const START_TAG = '\n<!-- prettier-ignore-start -->\n'; | |
const END_TAG = '\n<!-- prettier-ignore-end -->\n'; | |
function addPrettierIgnoreTags(content) { | |
const pattern = /---(?:\n.+)*\n---/g; | |
return content.replace(pattern, (match) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim.api.nvim_create_user_command("MarkdownTOC", function() | |
if vim.bo.filetype ~= "markdown" then | |
print("This is not a markdown file") | |
return | |
end | |
-- Extract the hashtags using grep | |
local hashtags = vim.fn.systemlist("grep -oE '^#+.*' " .. vim.fn.expand("%")) | |
local toc = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from "react" | |
export function useLocalStorage(key: string) { | |
const [value, setValue] = useState<string | null>(null) | |
const [isLoading, setIsLoading] = useState(true) | |
useEffect(function getInitialValue() { | |
setValue(localStorage.getItem(key)) | |
setIsLoading(false) | |
}, []) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from collections import Counter | |
from nltk.corpus import stopwords | |
# test1 - Common example | |
stops = stopwords.words("english") | |
# test2 - Using regex | |
pattern = re.compile(r"\b(" + r"|".join(stops) + r")\b\s*") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tranfer Files | |
Connect-VIServer -Server 192.168.1.100 -User vsphereusername@domain -Password vspherepassword | |
Set-Variable -Name "vms" -Value (Get-VM -Name "Group * - Web-IIS") | |
Copy-VMGuestFile -Source "C:\gene.json" -Destination C:\ -VM $vms -LocalToGuest -GuestUser username -GuestPassword password -Force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
import argparse | |
def clippings_to_dict(clip_file): | |
quotes = open(clip_file, 'r').read().split('==========') | |
split_quotes = [] | |
for quote in quotes: | |
# Remove empty lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Just put this in your ~/.bashrc, later use it by typing: | |
# title my title | |
function title() { | |
stitle=$@ | |
PROMPT_COMMAND='echo -ne "\033]0;$stitle\007"' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. git-sh-setup # For die | |
git diff --cached --name-status | | |
awk '$1 != "R" { print $2 }' | | |
xargs grep TODO --with-filename --line-number && | |
die Blocking commit - TODO detected in patch | |
exit 0 # Needed because this file must end with success code for git to continue |