Skip to content

Instantly share code, notes, and snippets.

View cphillips83's full-sized avatar

Chris Phillips cphillips83

View GitHub Profile
function k { kubectl @args }
function kl { kubectl logs @args }
function kg { kubectl get @args }
function kd { kubectl describe @args }
function ke { kubectl exec -it @args -- sh }
function kaf { kubectl apply -f @args }
function kdf { kubectl delete -f @args }
DECLARE @CurrentDataType VARCHAR(max)
DECLARE @DataTypeToChange VARCHAR(max)
DECLARE @SQLQUERY nvarchar(max)
SET @CurrentDataType = 'text' ---CHANGE HERE !!
SET @DataTypeToChange = 'nvarchar(max)' ---CHANGE HERE !!
DECLARE MY_CURSOR CURSOR
LOCAL STATIC READ_ONLY FORWARD_ONLY
FOR

Keybase proof

I hereby claim:

  • I am cphillips83 on github.
  • I am cphillips83 (https://keybase.io/cphillips83) on keybase.
  • I have a public key ASDqejrSmBkEJzargId4fRVaIFwIg4xbF0HaWKP-DvYRogo

To claim this, I am signing this object:

@cphillips83
cphillips83 / nginx.md
Last active March 7, 2020 03:09 — forked from joewiz/post-mortem.md
Recovery from nginx "Too many open files" error on Amazon AWS Linux

https://www.blackmoreops.com/2014/09/25/find-number-of-unique-ips-active-connections-to-web-server/

On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:

2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files) 2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...

An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.

    • Instead of using su to run ulimit on the nginx account, use ps aux | grep nginx to locate nginx's process IDs. Then query each process's file handle limits using cat /proc/pid/limits (where pid is the process id retrieved from ps). (Note: sudo may be necessary on your system for the cat command here, depend
//https://github.com/marcel-dempers/docker-development-youtube-series
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace dockergraveful
{
class Program
/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
{
var q0 = dc.Contacts
.Where(x => x.ID > 1 && x.Status == EntityStatus.Active)
.OrderByDescending(x => x.ID)
.Select(x => new { x.ID, x.Status });
var c0 = q0.FirstOrDefault();
Console.WriteLine(c0);
}
@cphillips83
cphillips83 / Program.cs
Created March 17, 2017 21:58
Kestrel not shutting down gracefully
using System;
using System.IO;
using System.Threading;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
namespace demo
{
[Route("api/[controller]")]
@cphillips83
cphillips83 / Nav
Last active December 23, 2016 17:00
{ "class": "go.TreeModel",
"nodeDataArray": [
{"key":0, "text":"NAV", "loc":"775 138"},
{"key":1, "text":"Dashboard", "parent":0, "loc":"721.0000000000001 272", "dir":"left", "font":"bold 13px sans-serif"},
{"key":3, "text":"Email", "parent":2, "loc":"662.9999999999998 419.00000000000006", "dir":"left"},
{"key":4, "text":"SMS", "parent":2, "loc":"662.9999999999997 445.00000000000006", "dir":"left"},
{"key":5, "text":"Social", "parent":2, "loc":"662.9999999999997 471.00000000000006", "dir":"left"},
{"key":2, "text":"Communicate", "parent":0, "brush":"#7284bf", "loc":"768.9999999999997 445.00000000000006", "dir":"left", "font":"bold 13px sans-serif"},
{"key":7, "text":"Overview", "parent":6, "loc":"474.99999999999955 -54.00000000000002", "dir":"left"},
{"key":8, "text":"Contacts", "parent":6, "loc":"474.9999999999999 -28", "dir":"left"},