Skip to content

Instantly share code, notes, and snippets.

View emrahgunduz's full-sized avatar

Emrah Gündüz emrahgunduz

  • @Impressions-app
  • California
View GitHub Profile
@emrahgunduz
emrahgunduz / imap-sync.sh
Created February 28, 2017 07:04
A bash script to clone multiple email-password combinations from one imap host to another. Requires imapsync installed/compiled and a csv file for email list. Uses port 993+ssl as default.
#!/bin/sh
# CSV file line example:
# some.name@domain.com,PASSWORD
if [ -z "$1" ]
then
echo "CSV file is not specified!"
exit 1
fi
@emrahgunduz
emrahgunduz / AViewClass.m
Created September 21, 2016 15:33
Working UIBlurEffect and UIVisualEffectView masking example on iOS10 using ObjectiveC
// "self" in here is an UIView that contains some images inside.
{
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blurredEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
CGRect frame = self.frame;
frame.origin = CGPointMake (0, 0);
blurredEffectView.frame = frame;
[self addSubview:blurredEffectView];
@emrahgunduz
emrahgunduz / Blur.swift
Created September 21, 2016 15:17
Playground example for working UIBlurEffect and UIVisualEffectView masking on iOS10 using Swift 3
import UIKit
import PlaygroundSupport
let generalFrame = CGRect(x: 0, y: 0, width: 500, height: 500)
let containerView = UIView(frame: generalFrame)
containerView.backgroundColor = UIColor.black;
PlaygroundPage.current.liveView = containerView
let parentView = UIView(frame: generalFrame)
@emrahgunduz
emrahgunduz / mail.rc
Last active April 5, 2019 10:14
Mailx and configuration for Cron email sending
set ask askcc append dot save crt
ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via D$
account forcron {
set smtp-use-starttls
set ssl-verify=ignore
set smtp-auth=login
set smtp=smtp://example.com:587
set from="Email Address <email@example.com>"
set smtp-auth-user=USERNAME
@emrahgunduz
emrahgunduz / CIImage_CVPixelBuffer.swift
Created August 4, 2020 22:05
BGRA to BGR convertion
import Foundation
import UIKit
extension CGImage {
public var cvPixelBuffer: CVPixelBuffer? {
let attrs = [
kCVPixelBufferCGImageCompatibilityKey: kCFBooleanTrue,
kCVPixelBufferCGBitmapContextCompatibilityKey: kCFBooleanTrue,
kCVPixelBufferMetalCompatibilityKey: kCFBooleanTrue
] as CFDictionary
@emrahgunduz
emrahgunduz / call.bat
Last active September 19, 2020 12:04
This is what Unreal Engine calls from Windows for SSH connection to a macos machine -- use if ip of macos changes
"C:\Program Files (x86)\Epic Games\4.14\Engine\Extras\ThirdPartyNotUE\DeltaCopy\Binaries\ssh.exe" -i '/cygdrive/D/Unreal/HitMe/Packer/Provision/ios/RemoteToolChainPrivate.key' -p 22 emrahgunduz@10.0.1.29
@emrahgunduz
emrahgunduz / AddToYourCppFile.cpp
Last active January 20, 2021 19:37
Image to Texture on UE4
static EImageFormat::Type GetJoyImageFormat(EJoyImageFormats JoyFormat)
{
switch (JoyFormat) {
case EJoyImageFormats::JPG: return EImageFormat::JPEG;
case EJoyImageFormats::PNG: return EImageFormat::PNG;
case EJoyImageFormats::BMP: return EImageFormat::BMP;
case EJoyImageFormats::ICO: return EImageFormat::ICO;
case EJoyImageFormats::EXR: return EImageFormat::EXR;
case EJoyImageFormats::ICNS: return EImageFormat::ICNS;
}
@emrahgunduz
emrahgunduz / health_check.py
Last active March 4, 2021 18:25
Python - Create a simple health check server (async)
import asyncio
import json
import threading
from aiohttp import web
def healthcheck_response ( data, *, text=None, body=None, status=200, reason=None, headers=None, content_type="application/json", dumps=json.dumps ):
return web.json_response(
data,
text=text,
@emrahgunduz
emrahgunduz / log.py
Created April 13, 2021 09:44
Simple auto flushing, thread safe logger for Elastic consumer (Singleton)
from __future__ import annotations
from typing import Union
import os
import uuid
import json
from datetime import datetime
from threading import Lock
class Log( object ):
@emrahgunduz
emrahgunduz / took.py
Created April 13, 2021 09:47
Simple thread safe process timer
from threading import Lock
import time
class Took:
def __init__ ( self ):
self.__lock = Lock()
with self.__lock:
self.__start = time.time()
self.__total = time.time()