Skip to content

Instantly share code, notes, and snippets.

@jenyayel
jenyayel / TraceLoggingProvider.cs
Created November 15, 2016 22:12
INpgsql trace logger
public class TraceLoggingProvider : INpgsqlLoggingProvider
{
public NpgsqlLogger CreateLogger(string name)
{
return new TraceLogger();
}
}
public class TraceLogger : NpgsqlLogger
{
@jenyayel
jenyayel / keybase.md
Created February 9, 2017 10:49
keybase.md

Keybase proof

I hereby claim:

  • I am jenyayel on github.
  • I am jenyay (https://keybase.io/jenyay) on keybase.
  • I have a public key ASDgRwIFzmFJbz-GJe2_wHmu87VQjtnCpq60rmNhSDNfXwo

To claim this, I am signing this object:

@jenyayel
jenyayel / __main__.py
Created February 20, 2017 15:36
Motion detector
from __future__ import print_function
from basicmotiondetector import BasicMotionDetector
from imutils.video import VideoStream
import numpy as np
import datetime
import imutils
import time
import cv2
# initialize the video streams and allow them to warmup
@jenyayel
jenyayel / SpecificOriginAttribute.cs
Created May 9, 2017 13:29
Writes dynamic `Access-Control-Allow-Origin` header
/// <summary>
/// When using 'withCredentials' in CORS, wildcard '*' cannot be used in the 'Access-Control-Allow-Origin'
/// header. The attribute generates a specific value for this header
/// </summary>
/// <seealso cref="System.Attribute" />
/// <seealso cref="Microsoft.AspNetCore.Cors.Infrastructure.ICorsPolicyProvider" />
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
public class SpecificOriginAttribute : Attribute, ICorsPolicyProvider
{
private string _originConfig;
@jenyayel
jenyayel / Program.cs
Created May 30, 2017 09:27
Exif date taken on from album name
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace ExifDateFixer
{
@jenyayel
jenyayel / ga-un-obfusticated.js
Last active August 29, 2020 11:48
Un-obfusticated Google Analytics with comments
(
/**
* @param {object} window - Reference to window object to make method shorter.
* @param {object} document - Reference to the element that will contain the script tag and to make method shorter.
* @param {string} scriptTagName - Contains the word 'script' to make method shorter.
* @param {string} scriptAddress - The address of the main script that we need to load.
* @param {string} globalName - This allows dynamically define global variable name to avoid conflicts with other SDKs.
* @param {object} scriptElement - Stores the element that will be created later (result variable to avoid declaration within the method body)
* @param {object} otherScriptElement - The script tag that already located in the body before which we'll inject a newly created script tag (result variable to avoid declaration within the method body)
*/
@jenyayel
jenyayel / jQueryLoader.js
Created November 19, 2017 20:32
jQuery async loader to page
function ensureJquery(readyCallback) {
if (window.jQuery === undefined || parseFloat(window.jQuery.fn.jquery) < 1.9) {
var js = document.createElement('script');
js.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js";
if (js.readyState)
js.onreadystatechange = function () {
if (this.readyState == 'complete' || this.readyState == 'loaded') {
jQueryLoadHandler();
}
};
@jenyayel
jenyayel / main.go
Created January 8, 2018 16:16 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@jenyayel
jenyayel / .bashrc.additions
Last active December 13, 2018 20:06 — forked from NickCraver/Windows10-Setup.ps1
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
export CLICOLOR=1
source ~/.git-completion.sh
PS1='\[\033[37m\]\W\[\033[0m\]$(__git_ps1 " (\[\033[35m\]%s\[\033[0m\])") \$ '
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
GIT_PS1_SHOWUPSTREAM="auto"
@jenyayel
jenyayel / PULL_REQUEST_TEMPLATE.md
Last active July 28, 2019 06:27
Repository readme.md file

Description

Please include a summary of the change and which issue is fixed.

  • If this a UI change, please add screenshots of what was added/changed.
  • If there are configurations added/changed, please list them here.

Type of change

  • Bug fix (non-breaking change which fixes an issue)