Skip to content

Instantly share code, notes, and snippets.

View viniciusjarina's full-sized avatar
😊

Vinicius Jarina viniciusjarina

😊
View GitHub Profile
@viniciusjarina
viniciusjarina / VSCodeSettings.json
Last active November 19, 2021 04:59
VSCodeSettings.json
{
"editor.fontSize": 16,
"editor.renderWhitespace": "all",
"workbench.colorTheme": "Visual Studio Light",
"telemetry.enableTelemetry": false,
"workbench.editor.enablePreview": false,
"explorer.confirmDelete": false,
"search.quickOpen.includeHistory" : false
}
@viniciusjarina
viniciusjarina / PSProfile.ps1
Last active January 26, 2021 16:04
~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Set-Alias -Name "open" -Value "explorer"
Import-Module 'C:\Users\vinic\posh-git\posh-git\src\posh-git.psd1'
#Import-Module 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevshell\Microsoft.VisualStudio.DevShell.dll'
#& { Import-Module 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevshell\Microsoft.VisualStudio.DevShell.dll'; Enter-VsDevShell -InstanceId bd6d43cd}
Import-Module 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevshell\Microsoft.VisualStudio.DevShell.dll'
Enter-VsDevShell -InstanceId bd6d43cd
# Settings for the prompt are in GitPrompt.ps1, so add any desired settings changes here.
# Example:
cd ~\projects\
@viniciusjarina
viniciusjarina / NLuaPost.md
Created December 27, 2020 22:56
NLuaPost.md

What is NLua?

NLua is a .NET library that allows you to easily integrate Lua in your C# application, calling Lua functions, reading Lua tables or calling C# methods from within Lua scripts. NLua is actually a fork of the project called LuaInterface from Craig Presti/Fabio Mascarenhas so most of features and documentation you find from LuaInterface should work with NLua.

Why you would want to use Lua on .NET?

You could use Lua to script parts of your application, allowing to quickly change behavior without having to rebuild your application. Scenarios like games, customization, extensions.

How to use NLua?

1B 4C 75 61 03 F8 00 19 93 0D 0A 1A 0A 04 08 08 78 56 00 00 00 00 00 00 .Lua.ø..“.......xV......
00 00 00 00 00 28 77 40 01 8A 40 74 65 73 74 2E 6C 75 61 80 80 00 .....(w@.Š@ test.lua€€.
01 02 96 51 00 00 00 0F 80 00 01 0F 80 02 03 0F 80 04 05 13 00 03 00 52 ..–Q....€...€...€......R
00 00 00 12 80 07 01 12 80 08 09 12 80 0A 0B 0F 00 06 00 13 00 02 00 52 ....€...€...€..........R
00 00 00 93 00 02 00 52 00 00 00 92 80 0E 0F 92 80 10 10 12 00 0D 01 12 ...“...R...’€..’€.......
80 11 11 0F 00 0C 00 4F 00 00 00 0F 00 12 00 46 00 01 01 93 04 86 77 69 €......O.......F...“.†wi
64 74 68 03 64 00 00 00 00 00 00 00 04 87 68 65 69 67 68 74 03 C8 00 00 dth.d........‡height.È..
00 00 00 00 00 04 88 6D 65 73 73 61 67 65 04 8D 48 65 6C 6C 6F 20 57 6F ......ˆmessage. Hello Wo
72 6C 64 21 04 86 63 6F 6C 6F 72 04 82 72 04 82 67 03 14 00 00 00 00 00 rld!.†color.‚r.‚g.......
00 00 04 82 62 03 32 00 00 00 00 00 00 00 04 85 74 72 65 65 04 88 62 72 ...‚b.2........…tree.ˆbr
B 4C 75 61 03 F8 00 19 93 0D 0A 1A 0A 04 08 08 78 56 00 00 00 00 00 00 .Lua.ø..“.......xV......
00 00 00 00 00 28 77 40 01 8C 40 2E 5C 74 65 73 74 2E 6C 75 61 80 80 00 .....(w@.Œ@.\test.lua€€.
01 02 96 51 00 00 00 0F 80 00 01 0F 80 02 03 0F 80 04 05 13 00 03 00 52 ..–Q....€...€...€......R
00 00 00 12 80 07 01 12 80 08 09 12 80 0A 0B 0F 00 06 00 13 00 02 00 52 ....€...€...€..........R
00 00 00 93 00 02 00 52 00 00 00 92 80 0E 0F 92 80 10 10 12 00 0D 01 12 ...“...R...’€..’€.......
80 11 11 0F 00 0C 00 4F 00 00 00 0F 00 12 00 46 00 01 01 93 04 86 77 69 €......O.......F...“.†wi
64 74 68 03 64 00 00 00 00 00 00 00 04 87 68 65 69 67 68 74 03 C8 00 00 dth.d........‡height.È..
00 00 00 00 00 04 88 6D 65 73 73 61 67 65 04 8D 48 65 6C 6C 6F 20 57 6F ......ˆmessage. Hello Wo
72 6C 64 21 04 86 63 6F 6C 6F 72 04 82 72 04 82 67 03 14 00 00 00 00 00 rld!.†color.‚r.‚g.......
00 00 04 82 62 03 32 00 00 00 00 00 00 00 04 85 74 72 65 65 04 88 62 72 ...‚b.2........…tree.ˆbr
width=100
height=200
message="Hello World!"
color={r=100,g=20,b=50}
tree={branch1={leaf1=10,leaf2="leaf2"},leaf3="leaf3"}
function func(x,y)
return x,x+y
end
@viniciusjarina
viniciusjarina / # Use_VS2017_WindowsTerminal.md
Last active March 11, 2020 21:57
Using Visual Studio 2017 From Windows Terminal

Using Visual Studio 2017 From Windows Terminal

VS 2017 doens't provide a PowerShell module like VS 2019. To make it work we need to do an small hack using VsDevCmd.bat to export VSDevCmd env vars to PowerShell

Save the VS2017.ps1 and add a new profile to the profiles.json

"commandline": "powershell.exe -NoExit -Command \". { . C:\\Users\\vinja\\Documents\\WindowsPowerShell\\VS2017.ps1 }\""
@viniciusjarina
viniciusjarina / VS2017.ps1
Created March 11, 2020 21:45
VS2017.ps1 to export VSDevCmd env vars to PowerShell
pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools"
cmd /c "VsDevCmd.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
// largestRectangle.cpp : Defines the entry point for the console application.
//
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;
@viniciusjarina
viniciusjarina / culturafm
Last active February 26, 2016 13:55
CulturaFM download
#!/bin/sh
if [$# -ne 2]; then
echo "Usage: $0 output lenght_seconds" >&2
exit 1
fi
#!/bin/sh
/Applications/VLC.app/Contents/MacOS/VLC -v "http://midiaserver.tvcultura.com.br:8003/;stream/1" --sout "#duplicate{dst=std{access=file,mux=raw,dst=$1.mp3}" --stop-time=$2 vlc://quit