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
@bepcyc
bepcyc / add_secret_to_bitwarden.sh
Created February 19, 2021 12:42
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})
@coskuncakir
coskuncakir / slugify.pipe.ts
Last active May 29, 2023 12:28 — forked from djabif/slugify.pipe.ts
Angular Pipe to transform a string into a slug with turkish character support.
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'slugify' })
export class SlugifyPipe implements PipeTransform {
transform(input: string): string {
const trChars = {
'çÇ': 'c',
'ğĞ': 'g',
'şŞ': 's',
'üÜ': 'u',
@jmcdo29
jmcdo29 / Explaination.md
Created July 17, 2019 01:02
tsconfig-paths bootstrap file to make registering paths work without problem

I've always had trouble using the given node -r tsconfig-paths/register path/to/main function from the command line, my paths never import correctly and I always seem to have an error when running after a build. After doing a bunch of digging around through packages and StackOverflow Q&A's I finally found a way to use tsconfig-paths programatically.

The tsconfig-bootstrap.js file makes use of tsconfig-pathsto register the paths from the compiler, and more than likely does exactly what tsconfig-paths/register is supposed to do. After requiring your tsconfig file you can access your baseUrl and paths via the JSON scheme of the config file to 100% programatically set your path imports to be correct, so that is anything changes in your config file this function doesn't need any chagning!

After you have the function set up, jsut add the following segment to your npm start command (whatever you have it called) and watch as your server fires up seamlessly:

# normal start without bootstrap
node
@tomsihap
tomsihap / gist:e703b9b063ecc101f5a4fc0b01a514c9
Created December 23, 2018 14:46
Install NVM in Ubuntu 18.04 with ZSH
# Find the latest version on https://github.com/creationix/nvm#install-script
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
# Add in your ~/.zshrc the following:
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
$ source ~/.zshrc
@djabif
djabif / slugify.pipe.ts
Last active August 26, 2024 16:02
Angular Pipe to transform a string into a slug
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'slugify'})
export class SlugifyPipe implements PipeTransform {
transform(input: string): string {
return input.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
@jchandra74
jchandra74 / PowerShell Customization.md
Last active August 20, 2024 20:27
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@chronon
chronon / ext.txt
Created February 18, 2017 15:38
List of docker-php-ext-install extension names
Possible values for ext-name:
bcmath
bz2
calendar
ctype
curl
dba
dom
enchant
@svmotha
svmotha / Sublime Text 3 Build 3103 License Key - CRACK
Created February 12, 2017 09:07
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
@lukas-h
lukas-h / license-badges.md
Last active September 17, 2024 21:32
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@tsabat
tsabat / zsh.md
Last active August 20, 2024 12:47
Getting oh-my-zsh to work in Ubuntu