Skip to content

Instantly share code, notes, and snippets.

View SirwanAfifi's full-sized avatar
🏠
Working from home

Sirwan Afifi SirwanAfifi

🏠
Working from home
View GitHub Profile
# watch-inbox.ps1
# File watcher that monitors 00 Inbox for new files and summarizes them
# Works on Windows with PowerShell
$ErrorActionPreference = "Stop"
# Get the vault root directory (grandparent of Scripts folder: 99 System/Scripts)
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$VaultRoot = Split-Path -Parent (Split-Path -Parent $ScriptDir)
@SirwanAfifi
SirwanAfifi / pizzaToBuy.js
Last active September 28, 2020 14:04
PizzaToBuy
const arr = [{ name: "Joe", num: 9 }, { name: "Cami", num: 3 }, { name: "Cassidy", num: 4 }];
let gimmePizza = (arr, sliceNum) => Math.ceil((arr.map(i => i.num).reduce((prev, next) => prev + next) / sliceNum));
gimmePizza(arr, 8);

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@SirwanAfifi
SirwanAfifi / gist:205d803829c92af76bac9eed3e19a628
Created August 29, 2017 06:16
SqlException: Invalid column name 'UserId'.
SqlException: Invalid column name 'UserId'.
System.Data.SqlClient.SqlCommand+<>c.<ExecuteDbDataReaderAsync>b__108_0(Task<SqlDataReader> result)
System.Threading.Tasks.ContinuationResultTaskFromResultTask.InnerInvoke()
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, object state)
System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref Task currentTaskSlot)
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand+<ExecuteAsync>d__17.MoveNext()
@SirwanAfifi
SirwanAfifi / amazon_rotten_tomatoes_score.py
Created June 13, 2017 08:24 — forked from aliostad/amazon_rotten_tomatoes_score.py
A simple script to find Amazon prime (UK) films and their rotten tomato score
from bs4 import BeautifulSoup
import codecs
import requests
def get_film_names(doc):
res = []
bs = BeautifulSoup(doc, 'html.parser')
for a in bs.select('ul li .s-item-container h2'):
name = a.text.replace('\t', ' ')
yearTags = a.parent.parent.select('> span.a-color-secondary')
@SirwanAfifi
SirwanAfifi / git-cheat-list.md
Created February 17, 2017 19:56
Git cheat list

Git cheat list

  • name of the current banch and nothing else (for automation)

    git rev-parse --abbrev-ref HEAD
    
  • all commits that your branch have that are not yet in master

    git log master..<HERE_COMES_YOUR_BRANCH_NAME>
    
@SirwanAfifi
SirwanAfifi / Channel9Downloader.ps1
Created December 3, 2016 08:41 — forked from jongalloway/Channel9Downloader.ps1
PowerShell Scripts for Downloading Channel 9 Videos
# --- settings ---
$feedUrl = "http://s.ch9.ms/Events/Build/2014/RSS/"
$mediaType = "mp4high"
$overwrite = $false
$destinationDirectory = join-path ([Environment]::GetFolderPath("MyDocuments")) "Build14Video"
# --- locals ---
$webClient = New-Object System.Net.WebClient
# --- functions ---
@SirwanAfifi
SirwanAfifi / getWeek.js
Created September 7, 2016 07:48 — forked from dblock/getWeek.js
get week of the year in JavaScript
function( d ) {
// Create a copy of this date object
var target = new Date(d.valueOf());
// ISO week date weeks start on monday
// so correct the day number
var dayNr = (d.getDay() + 6) % 7;
// Set the target to the thursday of this week so the
Server Error in '/' Application.
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Source Error: