Skip to content

Instantly share code, notes, and snippets.

View TiagoSoczek's full-sized avatar

Tiago Soczek TiagoSoczek

View GitHub Profile
# notepad $PROFILE
function prompt {
"PS $($executionContext.SessionState.Path.CurrentLocation)$([System.Environment]::NewLine)$('>' * ($nestedPromptLevel + 1)) ";
}
Set-Location C:\temp
@TiagoSoczek
TiagoSoczek / boxstarter.ps1
Last active July 15, 2018 04:56
Box Starter Script
# SETUP
Set-ExecutionPolicy RemoteSigned
. { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#---- TEMPORARY ---
Disable-UAC
# Windows
choco install Microsoft-Hyper-V -source WindowsFeatures
choco install Microsoft-Windows-Subsystem-Linux -source WindowsFeatures
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Debug@2017' -p 1433:1433 -d microsoft/mssql-server-linux
private static void HelloWorld(string msg)
{
var lista = new List<Foo>();
for (int i = 0; i < 100; i++)
{
lista.Add(new Foo
{
Bar = $"Id: {i}"
});
private void HighCpu()
{
int percentage = 80;
int duration = 15;
var resetEvent = new ManualResetEventSlim();
for (int i = 0; i < Environment.ProcessorCount; i++)
{
var th = new Thread(() =>
{
@TiagoSoczek
TiagoSoczek / app.js
Last active February 24, 2017 19:59
Contoso Shop - SPA
// definindo módulo raiz
angular.module('app', []);
angular.module('app').
controller('createProductController', createProductController);
angular.module('app').
controller('listProductsController', listProductsController);
var apiBaseAddress = 'http://localhost:57666';
@TiagoSoczek
TiagoSoczek / ASP.NET Core MVC - Refs.txt
Last active February 22, 2017 18:23
ASP.NET Core MVC - Refs.txt
https://haveibeenpwned.com/
https://www.pluralsight.com/courses/secure-account-management-fundamentals
ASP.NET Core Kestrel: Adventures in building a fast web server - Damian Edwards, David Fowler
https://vimeo.com/172009499
.NET Standard - Introduction
https://www.youtube.com/watch?v=YI4MurjfMn8
@TiagoSoczek
TiagoSoczek / postForm.js
Created July 9, 2015 19:18
Dynamic Form Creation with Javascript
// Create a form and post to _blank, this can be useful to avoid poup blocking
function postForm(action, data) {
var formAttrs = {
action: action,
target: '_blank',
method: 'post'
};
var form = $('<form />', formAttrs);
@TiagoSoczek
TiagoSoczek / flatObject.js
Last active August 29, 2015 14:24
Flat Object - Recursive function to flat object in Javascript
// Recursive function to flat object
function flatObject(source, destination, prefix) {
destination = destination || {};
prefix = prefix || '';
var keyPrefix = prefix.length > 0 ? prefix + "." : prefix;
for (var item in source) {
// http://haacked.com/archive/2009/01/14/named-formats-redux.aspx#70485
namespace Project.Extensions.NamedFormatter
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.Routing;
using System.Web.UI;