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} |
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 & |
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; |
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. |
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; | |
} |
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)) { |
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(',', '.')); | |
}); |
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 |
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 |
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)) { |
NewerOlder