Skip to content

Instantly share code, notes, and snippets.

View skarllot's full-sized avatar
💭
I may be slow to respond.

Fabrício Godoy skarllot

💭
I may be slow to respond.
View GitHub Profile
@skarllot
skarllot / TypeClipboard.md
Last active April 22, 2024 10:06 — forked from ethack/TypeClipboard.md
Scripts that simulate typing the clipboard contents. Useful when pasting is not allowed.

It "types" the contents of the clipboard.

Why can't you just paste the contents you ask? Sometimes pasting just doesn't work.

  • One example is in system password fields on OSX.
  • Sometimes you're working in a VM and the clipboard isn't shared.
  • Other times you're working via Remote Desktop and again, the clipboard doesn't work in password boxes such as the system login prompts.
  • Connected via RDP and clipboard sharing is disabled and so is mounting of local drives. If the system doesn't have internet access there's no easy way to get things like payloads or Powershell scripts onto it... until now.

Windows

The Windows version is written in AutoHotKey and easily compiles to an executable. It's a single line script that maps Ctrl-Shift-V to type the clipboard.

@skarllot
skarllot / net35-cf.md
Last active April 19, 2024 11:07
Build .NET Compact Framework 3.5

Install

Force MSBuild support

  • Copy files and directories from 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\*' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5';
  • Copy files from 'C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\Debugger\BCL\*' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\CompactFramework' directory;
  • Create 'RedistList' directory inside created 'CompactFramework' directory;
  • Create 'FrameworkList.xml' inside 'RedistList' directory and type the following:
@skarllot
skarllot / ChangeErrorsSubject.cs
Created April 7, 2024 21:18
Subject class for using INotifyDataErrorInfo with Avalonia UI
using System.Collections;
using System.Collections.Immutable;
using System.ComponentModel;
using System.Reactive.Subjects;
using CSharpFunctionalExtensions;
namespace Example;
public sealed class ChangeErrorsSubject : ISubject<ImmutableList<PropertyDataError>>, INotifyDataErrorInfo, IDisposable
{
@skarllot
skarllot / bacula-dir.conf
Last active March 28, 2024 23:35
Bacula configuration to use sendEmail
. . .
Messages {
Name = Standard
mailcommand = "/usr/local/bin/sendEmail-backup \"[BACKUP] %t %e of %n %l\" \"%r\""
operatorcommand = "/usr/local/bin/sendEmail-backup \"[BACKUP] Intervention needed for %j\" \"%r\""
mail = backup-handlers@example.com = all, !skipped
operator = backup-operator@example.com = mount
console = all, !skipped, !saved
append = "/var/log/bacula/bacula.log" = all, !skipped
catalog = all
@skarllot
skarllot / replacer.tf
Created March 22, 2024 17:27
Terraform multiple replaces
# Ref: https://stackoverflow.com/a/67392622/23266117
locals {
input = file("./sample.txt")
map = {
food = "Sushi"
name = "Data_sniffer"
}
out = join("\n", [
@skarllot
skarllot / FormatExtensions.cs
Created February 25, 2024 16:22
Allocation free int to string (incomplete)
public static class FormatExtensions
{
public static string Int32ToString(int a)
{
const int radix = 10;
const int maxLength = 11;
Span<char> str = stackalloc char[maxLength];
int i = str.Length;
bool isNegative = a < 0;
@skarllot
skarllot / .gitconfig
Created January 29, 2024 22:56
Git config include (Windows)
# Global
[includeIf "gitdir/i:C:/Users/<user>/Source/repos/github/<user>/"]
path = C:/Users/<user>/Source/repos/github/<user>/.gitconfig
[includeIf "gitdir/i:~/Source/repos/github/<user>/"]
path = ~/Source/repos/github/<user>/.gitconfig
# Path
[user]
email = <email>
@skarllot
skarllot / get-azure-current-user.cs
Created January 25, 2024 17:29
Get current Azure logged user
Claim displayName = ClaimsPrincipal.Current.FindFirst(ClaimsPrincipal.Current.Identities.First().NameClaimType);
ViewBag.DisplayName = displayName != null ? displayName.Value : string.Empty;
@skarllot
skarllot / make-icpbrasil-bundle.sh
Last active January 23, 2024 03:02
Download ICP-Brasil certificates and make a bundle
#!/bin/bash
HTTPADDR=http://acraiz.icpbrasil.gov.br/credenciadas/CertificadosAC-ICP-Brasil/ACcompactado.zip
DEST=/etc/ssl/certs/icp-brasil
mkdir -p ${DEST}
cd ${DEST}
rm -f *.crt
rm -f *.zip
@skarllot
skarllot / git-logs.sh
Last active December 12, 2023 18:53
Analyze Git commits between branches
# Format: - 2023-05-15 Name: Commit message
git log --cherry-pick --right-only --no-merges --reverse --pretty="- %ad %cn: %s" --date=short branch-a...branch-b
# Format: - 2023-05-15 Commit message
git log --cherry-pick --reverse --pretty="- %ad %<(35,trunc)%s" --date=short branch-a...branch-b
# Format: example@example.com 2023-04-25 initial commit
git log --cherry --reverse --pretty="%<(20,trunc)%ce%x09%>(10)%ad%x09%s" --date=short branch-a...branch-b
git log --cherry --reverse branch-a...branch-b