Skip to content

Instantly share code, notes, and snippets.

View rudygt's full-sized avatar
💭
code ftw

Rudy Alvarez rudygt

💭
code ftw
View GitHub Profile
@amitchhajer
amitchhajer / Count Code lines
Created January 5, 2013 11:08
Count number of code lines in git repository per user
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n
@imjasonh
imjasonh / markdown.css
Last active January 3, 2025 20:15
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@johnmmoss
johnmmoss / gist:8ee16837513ab69de4f3
Last active June 9, 2017 03:48
ASP.NET MVC FileStreamResult Example
// /File/Stream
public FileStreamResult Stream()
{
var fileContent = new byte[] { Ascii.one, Ascii.Comma, Ascii.two, Ascii.Comma, Ascii.three };
var stream = new MemoryStream(fileContent);
var fileStreamResult = new FileStreamResult(stream, mimeType);
fileStreamResult.FileDownloadName = "FileStreamExample.csv";
return fileStreamResult;
}
@ochinchina
ochinchina / docker_1.9_on_ubuntu_14.04.md
Created September 6, 2015 08:56
install the docker 1.9-dev to ubuntu 14.04

###add patch

get the script from https://get.docker.com/ubuntu/, the script is:

# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
	apt-get update
	apt-get install -y apt-transport-https
fi
@NickCraver
NickCraver / DmpAnalysis.linq
Last active May 1, 2024 21:09
DMP Analysis in LinqPad
<Query Kind="Program">
<NuGetReference Prerelease="true">Microsoft.Diagnostics.Runtime</NuGetReference>
<Namespace>Microsoft.Diagnostics.Runtime</Namespace>
<Namespace>System</Namespace>
<Namespace>System.IO</Namespace>
<Namespace>System.Linq</Namespace>
<Namespace>System.Text</Namespace>
<Namespace>Microsoft.Diagnostics.Runtime.Utilities</Namespace>
</Query>
@NickCraver
NickCraver / ExampleUsage.cs
Last active October 16, 2024 02:37
Code to mark a SQL string before it's passed to Dapper.
public static List<T> Query<T>(this DataContext db, string sql, object param = null, int? commandTimeout = null, IDbTransaction transaction = null, [CallerFilePath]string fromFile = null, [CallerLineNumber]int onLine = 0, string comment = null)
{
using (db.Connection.EnsureOpen())
{
try
{
return db.Connection.Query<T>(MarkSqlString(sql, fromFile, onLine, comment), param, transaction ?? db.Transaction, true, commandTimeout).AsDapperList();
}
catch (SqlException ex) when (ex.Is(SqlErrorCode.DatabaseReadOnly_3906))
{
@jessfraz
jessfraz / go-release-stats.md
Last active March 9, 2019 02:32
stats on the go 1.7 release for fun

Setup:

# set CONTRIBUTORS file to mailmap to remove duplicate emails for the same name
# see: https://git-scm.com/docs/git-shortlog#_mapping_authors
$ git config mailmap.file CONTRIBUTORS

Top 10 contributors (all):

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install 7zip /y
choco install docker-for-windows /y
choco install dotpeek /y
choco install git /y
choco install git-desktop /y
choco install googlechrome /y
choco install brave /y
choco install mousewithoutborders /y
@diversit
diversit / AWSDeserializer.scala
Created November 1, 2017 19:50
Deserialize json into a DynamodbEvent
package json;
import com.amazonaws.services.dynamodbv2.model.OperationType;
import com.amazonaws.services.dynamodbv2.model.StreamViewType;
import com.amazonaws.services.lambda.runtime.events.DynamodbEvent;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;