Skip to content

Instantly share code, notes, and snippets.

@dorzepowski
dorzepowski / ssh_sudo_setup.md
Created April 27, 2023 10:40
SSH sudo with TouchID

On the Mac

  1. Use the Secretive app to generate new ssh key
  2. Copy the public key to user’s ~/.ssh/authorized_keys on the server
ssh-copy-id -f -i <<path to public key>> <<username>>@<<ip>>

example:

ssh-copy-id -f -i /Users/${USER}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/PublicKeys/kfjakjflka481958917.pub [email protected]
package pl.sl
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.function.ThrowingSupplier;
import org.springframework.mail.MailException;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import javax.mail.Address;
import javax.mail.internet.MimeMessage;
@dorzepowski
dorzepowski / OneOf.ts
Created August 26, 2021 06:06
Typescript type which allow to set a value only on one from listed fields.
/**
* Make all properties in T optional except property with key U.
*
* @example
* type Example = OtherOptional<'a', { a: string; b: string; }> // { a: string; b?: never; }
*/
export type OtherOptional<U extends keyof T, T> = Pick<T, U> & Partial<T>;
/**
* Make all properties in T disallowed (type never) except property with key U.
@dorzepowski
dorzepowski / pre-request-auth.js
Created April 21, 2021 13:52
Pre Request Postman script to authenticate admin user
prepareAdminAuthToken();
function prepareAdminAuthToken() {
if(hasNotExpired()) {
return
}
const tokenRequest = createTokenRequest();
sendRequestForToken(tokenRequest);
@dorzepowski
dorzepowski / clockify.sh
Last active November 18, 2019 18:16
Clockify simple CLI
#!/bin/bash
########################################################################################################################
########################################################################################################################
# README:
#
# This script is currently prepared to add work log entries (time entries) to clockify from command line.
# Currently supported parameters for time entry are:
# - Project Name (project will be searched in clockify by name case sensitive)
# - Tag Name (tag will be searched in clockify by name case sensitive [only one tag can be provided currently])