Skip to content

Instantly share code, notes, and snippets.

View nedimf's full-sized avatar
🌴
Duba..ing

Nedim nedimf

🌴
Duba..ing
View GitHub Profile
@nedimf
nedimf / pascal_shell.py
Created August 31, 2019 15:14
Wraper for FCP (Pascal compiler) on Linux
#!usr/bin/python
# Developer : @nedimf
import sys
import os
from cmd import Cmd
import subprocess
from colorama import Fore,Back,Style
import signal
#Declaration of variables
@nedimf
nedimf / coffee.py
Created November 9, 2019 21:06
Reminder for coffee break (Linux&Python)
import threading
import notify2
def coffee():
threading.Timer(3600.0, coffe).start() #3600 seconds equals an hour
print ("Break!")
notify2.init('Reminder')
n = notify2.Notification('COFFE BREAK','Time for little break,you have been working really hard!') #Also you can costumize this part for your own message
n.show()
coffee()
@nedimf
nedimf / hapticFeedback.swift
Created October 25, 2020 20:20
Haptic Feedback
func hapticFeedback(for haptic: UINotificationFeedbackGenerator.FeedbackType){
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(haptic)
}
@nedimf
nedimf / FontNames-iOS12.swift
Created October 30, 2020 21:12 — forked from tadija/FontNames-iOS-17.4.swift
iOS - All Font Names
/*
*** Academy Engraved LET ***
AcademyEngravedLetPlain
---------------------
*** Al Nile ***
AlNile
AlNile-Bold
---------------------
*** American Typewriter ***
AmericanTypewriter
@nedimf
nedimf / cannot-unmarshal-dns-message-for-srv-lookup.md
Last active November 7, 2020 23:04
"cannot unmarshal DNS message" for SRV lookup MongoDB

Issue

 "cannot unmarshal DNS message" for SRV lookup

this gists won't go over DNS setup part for +srv to work

When you google this error, you will get something few results, one of which is this. If you are not using Docker that one will actually not help you, but will definitly give you perspective on a problem.

What does it mean?

@nedimf
nedimf / truncate+string.swift
Last active November 21, 2020 20:22
Truncate string and add "..." in the end - SWIFT
//Extension on String
extension String {
func truncating(max:Int) -> String{
let text = self
print("passed text \(text)")
if text.count >= max {
let truncatedIndex = text.index((text.startIndex), offsetBy: max)
@nedimf
nedimf / adding-cors-to-to-grpc-gateway.md
Created January 24, 2022 17:04
Adding CORS rules to grpc-gateway generated API

Issue

Access to XMLHttpRequest at 'http://localhost:8081/create/account' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Solution

important: please inform your self on safety behind CORS before adding this to your project

func allowCORS(h http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if origin := r.Header.Get("Origin"); origin != "" {