Skip to content

Instantly share code, notes, and snippets.

View ruslanguns's full-sized avatar
👨‍💻
copy/pasting some code from stack overflow

Ruslan Gonzalez ruslanguns

👨‍💻
copy/pasting some code from stack overflow
View GitHub Profile
@ruslanguns
ruslanguns / add_secret_to_bitwarden.sh
Created January 15, 2023 20:34 — forked from bepcyc/add_secret_to_bitwarden.sh
How to add secret content (e.g. a private key) to a bitwarden and how to restore it back. Chezmoi template included.
SECRET_NAME=id_rsa
SECRET_PATH=~/.ssh/id_rsa
# store the secret content as an item in bitwarden
echo "{\"organizationId\":null,\"folderId\":null,\"type\":2,\"name\":\"${SECRET_NAME}\",\"notes\":\"$(base64 -w 0 ${SECRET_PATH})\",\"favorite\":false,\"fields\":[],\"login\":null,\"secureNote\":{\"type\":0},\"card\":null,\"identity\":null}" | bw encode | bw create item
bw sync # optional
# retrieve the secret
# assuming a single search result
bw list items --search id_rsa | jq -r '.[0].notes' | base64 -d > ${SECRET_PATH}
# in case you're using chezmoi here's a template that will retrieve that secret automatically
#$cat $(chezmoi source-path ${SECRET_PATH})
@ruslanguns
ruslanguns / countries.enum.ts
Created March 23, 2020 12:07 — forked from evolkmann/countries.enum.ts
TypeScript Enum Country Codes ISO 3166
// Inspired by https://gist.github.com/kyranjamie/646386d5edc174e8b549111572897f81
export enum Country {
AF = 'Afghanistan',
AX = 'AlandIslands',
AL = 'Albania',
DZ = 'Algeria',
AS = 'American Samoa',
AD = 'Andorra',
AO = 'Angola',
AI = 'Anguilla',
@ruslanguns
ruslanguns / slugify.pipe.ts
Last active October 5, 2020 23:44 — forked from CoskunCakir/slugify.pipe.ts
Angular Pipe to transform a string into a slug with spanish character support.
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'slugify' })
export class SlugifyPipe implements PipeTransform {
transform(input: string): string {
const trChars = {
'áÁ': 'a',
'éÉ': 'e',
'íÍ': 'i',
'óÓ': 'o',
@ruslanguns
ruslanguns / generate-ssh-key.sh
Created June 26, 2018 09:56 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa