Skip to content

Instantly share code, notes, and snippets.

Avatar
🎉

Semih keskin semihkeskindev

🎉
View GitHub Profile
@semihkeskindev
semihkeskindev / docker-compose.yml
Created Jan 24, 2021
MsSQL (Microsoft SQL Server) Docker Compose File
View docker-compose.yml
version: '3'
services:
mssql-server-linux:
image: microsoft/mssql-server-linux:latest
volumes:
- mssql-server-linux-data:/var/opt/mssql/data
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=${SQLSERVER_SA_PASSWORD:-yourStrong(!)Password}
@semihkeskindev
semihkeskindev / tor.sh
Created Jan 1, 2021
Tor Proxy Connection for MAC OS X
View tor.sh
#!/usr/bin/env bash
# 'Wi-Fi' or 'Ethernet' or 'Display Ethernet'
INTERFACE=Wi-Fi
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@semihkeskindev
semihkeskindev / nginx.conf
Created Dec 14, 2020
Nginx remove index.php
View nginx.conf
if ($request_uri ~ "^(\/)index\.php$") {
return 302 $1;
}
if ($request_uri ~ "^(\/)index\.php\?(.*)") {
return 302 $1?$2;
}
if ($request_uri ~ "^(\/)index\.php\/(.*)") {
return 302 $1$2;
@semihkeskindev
semihkeskindev / youtube.js
Created Aug 25, 2020
get Youtube Video Id from Url
View youtube.js
// function
function getYoutubeUrlId (url) {
const urlObject = new URL(url);
let urlOrigin = urlObject.origin;
let urlPath = urlObject.pathname;
// Örneğin url https://youtu.be/V-uynt7UXXI ise
if (urlOrigin.search('youtu.be') > -1) {
// substr yapma sebebimiz, youtube kısaltma linklerinde id path'de olur ve pathname başında "/" olur.
// Örneğin "/V-uynt7UXXI" ise "V-uynt7UXXI" return eder.
@semihkeskindev
semihkeskindev / round_number_to_any_decimal_place.js
Last active Aug 10, 2020
Javascript function for Round to any decimal place
View round_number_to_any_decimal_place.js
function roundNumber(num, precision = 0) {
let decimalPlace = Math.pow(10, precision);
return Math.round((num + Number.EPSILON) * decimalPlace) / decimalPlace;
}
@semihkeskindev
semihkeskindev / clear_all_values_without_delete_props.js
Last active Aug 10, 2020
Clear all values without delete properties in object
View clear_all_values_without_delete_props.js
function clearAllValues(data, byTypeOf = false) {
let clearValuesTypeOf = {
boolean: false,
number: 0,
string: '',
}
// clear array if data is array
if (Array.isArray(data)) {
@semihkeskindev
semihkeskindev / trendyol_total_price_calculator.js
Last active Aug 10, 2020
Trendyol Toplam Harcama Hesaplayıcı
View trendyol_total_price_calculator.js
// Trendyol'da yaptığınız toplam harcamayı hesaplar.
// https://www.trendyol.com/hesabim/siparislerim sayfasına gidin.
// Tüm siparişleri listeleyin.
// Console'da function'ı çağırın. => calculateTotalPrice();
function calculateTotalPrice() {
let totalPrice = 0;
let prices = document.querySelectorAll('#orders-container .order .order-header .order-header-info:nth-child(4) b').forEach(function(item, index) {
totalPrice += parseFloat(item.innerText.replace(',', '.'));
});
@semihkeskindev
semihkeskindev / import_export_gz.sql
Created Apr 16, 2020 — forked from rakeshtembhurne/import_export_gz.sql
MySQL: Import and export in gzip form
View import_export_gz.sql
// Export database in gzip form
mysqldump -u user -p database | gzip > database.sql.gz
// Import database from gzip form
gunzip < database.sql.gz | mysql -u user -p database
@semihkeskindev
semihkeskindev / git_revert.sh
Created Apr 14, 2020 — forked from l1x/git_revert.sh
Using git checkout to revert to a certain commit hash
View git_revert.sh
#http://stackoverflow.com/a/6457473/127508
git checkout 56e05fced -- .
git add .
git commit -m 'Revert to 56e05fced'
And to prove that it worked:
git diff 56e05fced
@semihkeskindev
semihkeskindev / array_flatten.php
Created Mar 16, 2020 — forked from SeanCannon/array_flatten.php
PHP array_flatten() function. Convert a multi-dimensional array into a single-dimensional array.
View array_flatten.php
<?php
/**
* Convert a multi-dimensional array into a single-dimensional array.
* @author Sean Cannon, LitmusBox.com | seanc@litmusbox.com
* @param array $array The multi-dimensional array.
* @return array
*/
function array_flatten($array) {
if (!is_array($array)) {