Skip to content

Instantly share code, notes, and snippets.

@nimacks
nimacks / gist:7253276
Created October 31, 2013 17:04
AWS S3 Service Wrapper
using System.Collections.Generic;
using System.Diagnostics;
using Amazon;
using Amazon.S3;
using Amazon.S3.Model;
namespace S3Navigator.AWS
{
public class AwsService
{
private readonly AmazonS3 _client;
public static class ObjectExtensions
{
/// <summary>
/// Acts as a null dereference operator
/// </summary>
/// <typeparam name=”T”> Type of Object for null check</typeparam>
/// <typeparam name=”TResult”> resulting type of the expression</typeparam>
/// <param name=”item”> Object to check for null on </param>
/// <param name=”deriver”> delegate to return result</param>
/// <returns></returns>
@nimacks
nimacks / queryStringsInJavascript
Created May 30, 2014 04:54
How to retrieve query string values in javascript
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));}
Usage:
var prodId = getParameterByName('prodId');
@nimacks
nimacks / gist:b3396686b33590e3ef7e
Created February 18, 2015 17:20
BCP Import Refactoring
void Main()
{
//Setup Chain of Responsibility
ImportPhase readData = new DataReadingPhase();
ImportPhase mapData = new DataMappingPhase();
ImportPhase importData = new DataImportPhase();
readData.SetNextPhase(mapData);
mapData.SetNextPhase(importData);
public class Program
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public static void Main(string[] args)
{
string connectionString = @"Data Source=pc-samuelnm;Integrated Security=True";
var sourceDataTable = GetSourceDataTable();
SqlBulkCopySettings settings = SqlBulkCopySettings.GetSettings();
@charset "UTF-8";
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
}
h1 {
color: #fff;
font-size: 36px;
/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@nimacks
nimacks / iterm2.md
Created April 27, 2020 05:49 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@nimacks
nimacks / README.md
Created November 15, 2020 04:47 — forked from petermorlion/README.md
Find AWS lambda cold start durations

Full code I used to get the amount and duration of AWS Lambda cold starts during 2 given months.

Also see the question on StackOverflow.