My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
function ConvertTo-Object { | |
param( | |
[Parameter(Mandatory=$true,ValueFromPipeline=$true)] | |
[AllowEmptyString()] | |
[string[]]$InputString, | |
[Parameter(Mandatory=$true,ValueFromRemainingArguments=$true)] | |
[string[]]$Pattern | |
) |
#!/bin/bash | |
# This script intend to mimic TimeMachine exclude list. | |
# As the exclude list can evolve between backups it has to be rebuilt before every backup | |
# Apple uses 5 types of excludes, four from the /System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist file | |
# and files from applications where metadata says to not backup, these can be found usinf | |
# sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'" | |
SYSLOG=/usr/bin/syslog; | |
TEMPFILE=$1; |
function Start-Demo { | |
[CmdletBinding()] | |
param( | |
# A history file with a command on each line (or using ` as a line-continuation character) | |
[Parameter(Mandatory)] | |
[Alias("PSPath")] | |
[string]$Path | |
) | |
[Microsoft.PowerShell.PSConsoleReadLine]::ClearHistory() |
*update: TBC, but this new might affect how easy it is to use this technique past August 2024: Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August
This gist, based in part on a gist by Brian Hartvigsen, allows you to export from Authy your TOTP tokens you have stored there.
Those can be "standard" 6-digits / 30 secs tokens, or Authy's own version, the 7-digits / 10 secs tokens.
I'm learning about SOPS and setting it up as my preferred mechanism for storing secrets. Here are my notes.
It’s security mechanism is that we (i.e. client) use a PUBLIC key from the receiver (i.e. server) and encode it with a random key (I’m saying nonce but it could be reused)
This varies from RSA and SSH because the server uses a PUBLIC key to identify the client.
Web of trust operates by still using PGP (i.e. encoding with recipient’s public key) but additionally, we can encrypt/sign the data as our own by signing it with the client’s private key.
This means the recipient will initially decrypt via our (i.e. client’s) public key (verifying the source) and then decrypting via their (i.e. server’s) private key to get the data.
Function Get-WinEventXPathFilter | |
{ | |
<# | |
.SYNOPSIS | |
This function generates an xpath filter that can be used with the -FilterXPath | |
parameter of Get-WinEvent. It may also be used inside the <Select></Select tags | |
of a Custom View in Event Viewer. | |
.DESCRIPTION | |
This function generates an xpath filter that can be used with the -FilterXPath | |
parameter of Get-WinEvent. It may also be used inside the <Select></Select tags |
### SYMBOLIC LINK FILES | |
# Create a new symbolic link file named MySymLinkFile.txt in C:\Temp which links to $pshome\profile.ps1 | |
cd C:\Temp | |
New-Item -ItemType SymbolicLink -Name MySymLinkFile.txt -Target $pshome\profile.ps1 # File | |
# Target is an alias to the Value parameter | |
# Equivalent to above | |
New-Item -ItemType SymbolicLink -Path C:\Temp -Name MySymLinkFile.txt -Value $pshome\profile.ps1 | |
# Equivalent to above |
require_relative "test_helper" | |
require "open-uri" | |
require "net/http" | |
class EmojiTest < Blog::Test | |
def test_no_emoji | |
posts.each do |post| | |
content = File.read(post) | |
refute_match /:[a-zA-Z0-9_]+:/, content, |