Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Fatih YILDIZHAN fatihyildizhan

🎯
Focusing
View GitHub Profile
@fatihyildizhan
fatihyildizhan / traefikv2-gzip-compression.txt
Last active Jul 21, 2020
Traefik v2 - How to enable gzip compression
View traefikv2-gzip-compression.txt
### Traefik v2 docker-compose.yml
version: '3.7'
services:
traefik:
image: traefik:v2.2.7
container_name: traefik
labels:
@fatihyildizhan
fatihyildizhan / swift-lower-or-uppercase.swift
Created Apr 28, 2020
Force to lower or uppercase on Swift
View swift-lower-or-uppercase.swift
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
if textField.isEqual(textFieldBodrum) {
textFieldBodrum.text = (textField.text as NSString).stringByReplacingCharactersInRange(range, withString: string.lowercaseString)
return false
} else if textField.isEqual(textFieldYalikavak) {
textFieldYalikavak.text = (textField.text as NSString).stringByReplacingCharactersInRange(range, withString: string.uppercaseString)
return false
}
return true
}
@fatihyildizhan
fatihyildizhan / github-domain-verification.txt
Created Mar 20, 2020
GitHub Domain Verification Steps
View github-domain-verification.txt
1. go to your organization settings
2. set the url under profile then click update
3. go to verified domain section and click Add a domain
4. enter the same url
5. GitHub shows you this message:
Add a DNS TXT record
Create a TXT record in your DNS configuration for _github-challenge-YOURORGANIZATIONNAME.YOURDOMAIN.
Use this code as the value for the TXT record:
YOUR VERIFICATION CODE
View npm i expo-cli --global.txt
I used these to install it:
bash you need to change the default terminal as bash first.
-> https://conemu.github.io/
maybe the new windows terminal does support bash too
-> https://github.com/microsoft/terminal/releases
Install Nodejs: (I don't need a higher version and it can give errors.)
-> v12.9.0
@fatihyildizhan
fatihyildizhan / blockchain.py
Created Dec 21, 2019
Create a simple Blockchain with python
View blockchain.py
import json
import hashlib
import datetime
from flask import Flask, jsonify, request
import requests
from uuid import uuid4
from urllib.parse import urlparse
# Part 1 - Building a Blockchain
View keep busy to avoid becoming idle
while($true)
{
Sleep 20
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('C:\WINDOWS\system32\cmd.exe')
Sleep 1
$wshell.SendKeys('s')
$promptStringStart = (Get-Date).ToLongDateString() +" - "+ (Get-Date).ToLongTimeString() + " running... "
Write-Host $promptStringStart -NoNewLine -ForegroundColor Green
@fatihyildizhan
fatihyildizhan / Upgrade Older Expo Versions to 33+ with yarn or npm.txt
Created Dec 19, 2019
Upgrade Older Expo Versions to 33+ with yarn or npm
View Upgrade Older Expo Versions to 33+ with yarn or npm.txt
1- app.json > change sdk version to "sdkVersion": "33.0.0"
2- package.json > change these to
"expo": "^33.0.0"
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz"
3- delete node_modules folder
4- yarn cache clean
5- npm install node-pre-gyp ** if you are on Windows
@fatihyildizhan
fatihyildizhan / Docker + Traefik + Let's Encrypt + Github Repository
Last active Jan 26, 2021
Docker + Traefik v1.7 and 2.0 + Let's Encrypt + Github Repository
View Docker + Traefik + Let's Encrypt + Github Repository
Docker + Traefik + Let's Encrypt + Github Repository
Using:
- Ubuntu 19.04
- Docker Engine 19.03
- Docker Compose 1.25.0-rc2
- Traefik v1.7.18 with dnsChallenge
- Traefik v2.0.1 with httpChallenge
--
- Github Registry
View Simple Swift Sound Player
import Foundation
import AVFoundation
final class MediaPlayer {
static var player = AVAudioPlayer()
class func play() {
do {
let file = Bundle.main.url(forResource: "file_name", withExtension: "mp3")!
player = try AVAudioPlayer(contentsOf: file)
View gist:699e9660895f3585e3f9355f5e5b627b
import UIKit
import AudioToolbox
struct SoundPlayer {
static var filename : String?
static var enabled : Bool = true
private struct Internal {
static var cache = [URL:SystemSoundID]()
}