Skip to content

Instantly share code, notes, and snippets.

View bdogan's full-sized avatar
🎯
Focusing

Burak Doğan bdogan

🎯
Focusing
View GitHub Profile
@bdogan
bdogan / self-signed-certificate-with-custom-ca.md
Created June 24, 2019 11:06 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@bdogan
bdogan / gist:c7db4de4814924847853dff3c3c33315
Created November 17, 2018 13:59
Pagination const width
Dim pLastPage : pLastPage = gelen_sayfa_sayisi
Dim oCurrentPage : oCurrentPage = gelen_secili_sayfa
Dim oPagesWidth, oPageCursor : oPagesWidth = 4 : oPageCursor = 1
Dim oPageStart : oPageStart = oCurrentPage - oPagesWidth
Dim oPageEnd : oPageEnd = oCurrentPage + oPagesWidth
If (oPageStart <= 0) Then oPageEnd = oPageEnd - (oPageStart - 1) : oPageStart = 1
If (oPageEnd > pLastPage) Then oPageStart = oPageStart - (oPageEnd - pLastPage) : oPageEnd = pLastPage
@bdogan
bdogan / bundle.html
Last active November 20, 2018 11:26
Klüber türkiye bayi gösterimi
<div id="map"></div>
<style>
#map a,.worldwide-layer .head a{color:#fdb913;text-decoration:none}#map blockquote,#map button,#map code,#map dd,#map div,#map dl,#map dt,#map fieldset,#map form,#map h1,#map h2,#map h3,#map h4,#map h5,#map h6,#map input,#map legend,#map li,#map ol,#map p,#map pre,#map td,#map textarea,#map th,#map ul{margin:0;padding:0}#map a{-webkit-transition:all .25s;-moz-transition:all .25s;-o-transition:all .25s;transition:all .25s}#map h3{line-heigt:1.25;margin-top:2.13018em;margin-bottom:1.18343em}#map h1,#map h2,#map h3,#map h4,#map h5,#map h6{font-size:100%;font-weight:400}#map>*{box-sizing:border-box}#map{width:50%;min-width:600px;height:100%;margin:0 auto}#location-info{-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.worldwide-layer{font-family:"Helvetica World W01",sans-serif;font-size:14px;padding-bottom:40px;width:470px;max-height:100vh}.worldwide-layer>div:first-child{padding-top:5px;padding-bottom:5px}.worldwide-layer .head{position:relative}.worldwide
@bdogan
bdogan / move_row_in_array.js
Created February 22, 2018 11:18
Move rows in array
/**
* Move row by source / target
*
* Column Count = 4
* [
* 1 , 2 , 3 , 4,
* 5 , 6 , 7 , 8, * (SourceRow = 2, elCount = 1)
* 9 , 10, 11, 12,
* 13, 14, 15, 16, * (TargetRow = 4)
* 17, 18, 19, 20,
@bdogan
bdogan / s3-nginx-log-rotate.sh
Created December 23, 2017 10:40 — forked from mustafaturan/s3-nginx-log-rotate.sh
S3 Nginx Log rotation file
#!/bin/bash
BUCKETNAME="your_s3_bucket"
LOGDIR="/opt/nginx/logs"
LOGDATE=$(date +"%Y%m%d")
LOGFILES=( "access" "ssl-access" )
BOT_LOGFILES=( "bots-access" "bots-ssl-access" )
echo "Moving access logs to dated logs.."
@bdogan
bdogan / pattern-input.js
Created April 26, 2017 14:46
Pattern Input
let pattern = "[a-zöçşiğü]*";
let oldValue = "";
let oldPosition = 0;
document.getElementById("#test").addEventListener('keydown', function(event) {
oldPosition = event.target.selectionStart;
oldValue = event.target.value;
});
document.getElementById("#test").addEventListener('input', function(event) {
@bdogan
bdogan / secure redirect
Last active March 29, 2017 13:38
Platinmarket https redirection
if (window.location.protocol == 'http:') {
function hasValidCertificate(cb) {
var img = new Image();
img.onload = () => cb(true);
img.onerror = () => cb(false);
img.src = `https://${window.location.host}${window.location.port == 80 ? '' : window.location.port}/img/logo.jpg`;
}
hasValidCertificate(result => result === true ? window.location = window.location.toString().replace('http:', 'https:') : () => {});
}
@bdogan
bdogan / mime.css
Last active March 13, 2017 08:13
Fontawesome file type icon
/*
FILE FORMAT ICONS
by Greg Schoppe (http://gschoppe.com)
USAGE: include FontAwesome on page, as shown on http://fontawesome.io
then include this css file, and target links by adding the link-icon
class. Note: try to avoid or manually label links to websites, as that
detection code is necessarily janky. when in doubt, just end all external
links with a trailing slash (/), a query string (?), or a link target (#)
*/
i.mime:before {
@bdogan
bdogan / popup-video.html
Last active February 16, 2017 20:45
Popup Video Html
<html>
<head></head>
<body>
<style>.modal,.modal-open{overflow:hidden}.modal,.modal-backdrop{top:0;right:0;bottom:0;left:0}.modal{display:none;position:fixed;z-index:1050;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%);-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-background-clip:padding-box;background-clip:padding-box;outline:0}.mod