Skip to content

Instantly share code, notes, and snippets.

View fcmendoza's full-sized avatar
💭
My future look cloud-y

Fernando Mendoza fcmendoza

💭
My future look cloud-y
View GitHub Profile
@fcmendoza
fcmendoza / get_git.sh
Last active April 18, 2022 16:09
Geet Get Git
# See comments for examples
@fcmendoza
fcmendoza / gogogo.go
Created May 9, 2019 19:44
Go Go Power Rangers
// See comments for examples.
# See comments for examples
@fcmendoza
fcmendoza / main.tf
Last active December 23, 2018 18:40
Create EC2 instance via Terraform
provider "aws" {
access_key = "YOURACCESSKEYHERE"
secret_key = "YOURSECRETKEYHERE"
region = "us-west-1"
}
resource "aws_instance" "example" {
ami = "ami-00048435fed26a8d1" # Ubuntu 14.04 LTS
instance_type = "t2.micro"
key_name = "my_keypair"
private void SaveWhiteBlackListDataImportFile(IEnumerable<PartInfoImportFile> parts, int userID)
{
using (var sqlConnection = new SqlConnection(_connectionString))
{
sqlConnection.Open();
using (var multi = sqlConnection.QueryMultiple("dbo.SavePartInfoImportFileData",
new PartInfoDynamicParam("ParameterTable", parts, userID),
commandType: CommandType.StoredProcedure, commandTimeout: 120)) {
}
@fcmendoza
fcmendoza / 01_rebuild_custom.ps1
Last active September 4, 2017 23:04
Powershell script to "hard" rebuild a Visual Studio solution
cls
ECHO "Hard rebuilding 'Main' solution. Go get some coffee, this is going to take a few minutes ..."
$stopWatch = [system.diagnostics.stopwatch]::startNew()
ECHO "Cleaning solution ..."
devenv C:\Projects\Main.sln /clean
ECHO "Deleting remaining contents in bin folders ..."
@fcmendoza
fcmendoza / funcs.cs
Last active April 5, 2016 16:26
Understanding how Func<T> works.
using System;
public class Program
{
public static void Main() {
new Functions().Start();
}
}
public class Functions
public class PoorContainer {
public void Register<T>(T t) {
types.Add(typeof(T), t);
}
public T Resolve<T>() {
return (T)types[typeof(T)];
}
private readonly Dictionary<Type, object> types = new Dictionary<Type, object>();
@fcmendoza
fcmendoza / reseed.sql
Last active December 16, 2015 04:09
Reseed tables
select t.full_name as table_name, c.column_name, case when c.system_type_id = 127 then 9223372036854775808/2 else 2147483648/2 end as seed_value
from sys_columns c
inner join sys_tables t on t.full_name = c.full_name
where c.is_identity = 1 and t.is_replicated = 1
order by t.full_name
select 'DBCC CHECKIDENT(''' + t.full_name + ''', reseed, ' + cast(cast(2147483648/2 as int) as varchar) + ')' as reseed_command
,t.full_name as table_name, c.column_name, cast(2147483648/2 as int) seed_value
from sys_columns c
inner join sys_tables t on t.full_name = c.full_name
@fcmendoza
fcmendoza / evil_ifs.c
Last active December 12, 2015 10:19
Evil if
// Evil if:
if (x == 1) {
if (x == 1.1) {
print("lorem ipsum 1.1")
}
else if (x == 1.2) {
print ("lorem ipsum 1.2")
}
else if (x == 1.3) {