Skip to content

Instantly share code, notes, and snippets.

@melcloud
melcloud / gitconfig
Created January 16, 2024 23:42
My gitconfig
[pull]
ff = true
[mergetool]
KeepBackup = false
prompt = false
[alias]
gcg = config --global
co = checkout
cob = checkout -b
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
*.{ps1,[pP][sS]1} text eol=crlf
*.{psm1,[pP][sS][mM]1} text eol=crlf
###############################################################################
# Created by https://www.toptal.com/developers/gitignore/api/vim,linux,macos,windows,packer,powershell,visualstudio,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,linux,macos,windows,packer,powershell,visualstudio,visualstudiocode
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences

Keybase proof

I hereby claim:

  • I am melcloud on github.
  • I am melcloud (https://keybase.io/melcloud) on keybase.
  • I have a public key ASBkpTspcoyjHr57d4_Q0xCiuF12yhJR8gqGVjlG2wlz6Ao

To claim this, I am signing this object:

@melcloud
melcloud / .editorconfig
Last active November 28, 2019 01:26
Editorconfig combined from Microsoft
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{ps1,psm1,cmd,bat}]
@melcloud
melcloud / .editorconfig
Created November 26, 2019 19:27
editoconfig for .net
root = true
[*]
charset = utf-8
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
indent_size = 2
end_of_line = lf
@melcloud
melcloud / az.completion
Created March 28, 2019 10:43
Bash completion when running azure cli in docker
_python_argcomplete() {
local IFS=$'\013'
local SUPPRESS_SPACE=0
if compopt +o nospace 2> /dev/null; then
SUPPRESS_SPACE=1
fi
COMPREPLY=( $(docker run -i --rm -e "IFS=$IFS" \
-e "COMP_LINE=$COMP_LINE" \
-e "COMP_POINT=$COMP_POINT" \
-e "COMP_TYPE=$COMP_TYPE" \
Delete the relevant section from .gitmodules
git add .gitmodules
Delete the relevant section from .git/config
git rm --cached MODULE/TO-REMOVE
rm -rf .git/modules/MODULE/TO-REMOVE
rm -rf MODULE/TO-REMOVE
git add .
git commit
git push
@melcloud
melcloud / AsyncLoop.cs
Created May 28, 2017 09:44
Async event loop in C#
private static async Task EventLoop(BufferBlock<object> bufferBlock, CancellationToken cancellationToken)
{
while (true)
{
object msg;
try
{
msg = await bufferBlock.ReceiveAsync(TimeSpan.FromSeconds(3), cancellationToken);
}
catch (TimeoutException)
@melcloud
melcloud / elixir.md
Created July 12, 2016 11:22
Elixir Study Note

iex

  • h or h() for help do. The number following the slash is the number of arguments (cd/1)
  • usage h IO or h(IO)
  • i which displays information for value. E.g. i 3
  • IEx.configure ​ colors: ​ [ ​ eval_result: ​ [ ​ :cyan ​, ​ :bright ​ ] ]
  • These files will typically have the extension .ex or .exs . This is a convention—files ending in .ex are intended to be compiled into bytecodes and then run, whereas those ending in .exs are more like programs in scripting languages—they are effectively interpreted at the source level. When we come to write tests for our Elixir programs, you’ll see that the application files have .ex extensions, whereas the tests have .exs because we don’t need to keep compiled versions of the tests lying around.