Skip to content

Instantly share code, notes, and snippets.

View cds-amal's full-sized avatar
🏠
Working from home

cds-amal cds-amal

🏠
Working from home
  • Flushing USA
View GitHub Profile
@cds-amal
cds-amal / move-stashes.md
Created February 27, 2021 01:31 — forked from alexeds/move-stashes.md
Move your stashes from one repo to another

Move your stashes from one repo to another


This was useful for me when we created a new branch for a new major release, but were still working on our current version as well. I cloned our repo again and kept the new project on our new branch, but also wanted to get my stashes there.

Download your stashes

git stash show -p > patch

You'll have to specify your stash and name your file whatevery you want. Do this for as all your stashes, and you'll have patch files in your pwd.

@cds-amal
cds-amal / How I Do PlantUML.md
Created February 17, 2021 18:17 — forked from jerieljan/How I Do PlantUML.md
PlantUML with Style -- How I do PlantUML

I use PlantUML a lot. It's what I use for drawing all sorts of diagrams and it's handy because of its easy markup (once you get used to it) while making things easy to maintain as projects grow (thanks to version control)

This gist explains how I do my PlantUML workspace in a project.

  • The idea is to keep a globals directory for all diagrams to follow (like the "stylesheet" below) to keep things consistent.
  • I use a stylesheet.iuml file that keeps the use of colors consistent through use of basic FOREGROUND, BACKGROUND and ACCENT colors.
  • The style-presets.iuml file defines these colors so you can make "presets" or "themes" out of them.
  • As stated in the stylesheet.iuml, you'll need the Roboto Condensed and Inconsolata fonts for these to work properly.
  • You can choose to either run the PlantUML jar over your file/s, or use an IDE like VSCode with the PlantUML extension. Here's a preview of example-sequence.puml for example: https://imgur.com/Klk3w2F
@cds-amal
cds-amal / openvpn.md
Created February 5, 2021 00:04 — forked from Morley93/openvpn.md
This is how you can take an openvpn .ovpn config file and extract the certificates/key required to import the profile into NetworkManager.

OpenVPN .ovpn manipulation.

This is how you can take an OpenVPN .ovpn config file and extract the certificates/keys required to import the profile into NetworkManager.

  • Download the .ovpn file. Save it somewhere you can store it permanently (I use ~/.vpn).
  • Copy from between <ca> tags into ca.crt, remove <ca> tags.
  • Copy from between <cert> tags into client.crt, remove <cert> tags.
  • Copy from between <key> tags into client.key, remove <key> tags.
  • Copy from between <tls-auth> tags into ta.key, remove <tls-auth> tags.
  • Remove the line "key-direction 1"
  • Above "# -----BEGIN RSA SIGNATURE-----" insert the following lines.
[ INFO ] 2021-01-24T20:44:13-0500 ] ...ovim/HEAD-69103ff/share/nvim/runtime/lua/vim/lsp/rpc.lua:311 ] "Starting RPC client" { args = { "--stdio" }, cmd = "typescript-language-server", extra = {}}
[ DEBUG ] 2021-01-24T20:44:13-0500 ] ...r/neovim/HEAD-69103ff/share/nvim/runtime/lua/vim/lsp.lua:647 ] "LSP[tsserver]" "initialize_params" { capabilities = { callHierarchy = { dynamicRegistration = false, <metatable> = <1>{ __tostring = <function 1> } }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }, <metatable> = <table 1> }, <metatable> = <table 1> }, dynamicRegistration = false, <metatable> = <table 1> }

0xee1b7d093a60b4d4c7881b0935832b35c9494b55dae1715e58a56b15010005bb

click for SVG render

@startuml

skinparam legendBackgroundColor #fefece
#!/usr/bin/env bash
# build the specific package you need to save Time
# like environment for example
cd packages/environment && yarn && cd -
# run your test condition - this returns 0 for success or not zero otherwise
# for example, if the bug can be demonstrated by truffle test in a specific truffle project
# do this
cd ~/dev/test-wsl && ~/dev/truffle/packages/core/cli.js test

Vim: pushing built-in features beyond their limits

The situation

Searching can be an efficient way to navigate the current buffer.

The first search commands we learn are usually / and ?. These are seriously cool, especially with the incsearch option enabled which lets us keep typing to refine our search pattern. / and ? really shine when all we want is to jump to something we already have our eyeballs on but they are not fit for every situation:

  • when we want to search something that's not directly there, those two commands can make us loose context very quickly,
  • when we need to compare the matches.
@cds-amal
cds-amal / ssh-tutorial.md
Created August 17, 2020 21:48 — forked from slowkow/ssh-tutorial.md
ssh to a server without typing your password

How to ssh to a remote server without typing your password

Save yourself a few keystrokes. Follow the steps below:

  1. Run this Bash script on your laptop:

    #!/usr/bin/env bash
    

The hostname of your remote server.

@cds-amal
cds-amal / VimScriptForPythonDevelopers.MD
Created May 25, 2020 08:35 — forked from yegappan/VimScriptForPythonDevelopers.MD
Vim script for Python Developers

Vim Script for Python Developers

A guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with programming in Python.

For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way


Variables

setlocal tabstop=2 shiftwidth=2 softtabstop=0 expandtab foldlevel=3
" For zsh vi-mode command split
" splits a single line command on every -- or -,
" appending a \ on every eol
" mnemonic: cs = command split
nnoremap <localLeader>cs :s:\(\s\+\)\(-\{1,2}[^-]\): \\\r \2:g<CR>