cd /var/www/
sudo mkdir .nvm
sudo mkdir .npm
sudo chown www-data -R .nvm/ .npm/
cd ~
sudo su -s /bin/bash www-data
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
import fcntl | |
import time | |
def non_block_read(output): | |
fd = output.fileno() | |
fl = fcntl.fcntl(fd, fcntl.F_GETFL) | |
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK) | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class color: | |
listOfColors = { | |
"info": "\033[94m", | |
"secondary": "\033[2m", | |
"success": "\033[92m", | |
"warning": "\033[0;33m", | |
"danger": "\033[0;31m", | |
"bg_info": "\033[0;44m", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
slug = $('#cphPageContent_txtbxStokKodu').val(); | |
slugNum = slug.slice(-2); | |
newNum = parseInt(slugNum) + 1 | |
if(newNum < 10) { | |
newNum = "0" + newNum | |
} | |
$('#txtbxAdres').val('magaza/bisiklet/aksesuar/m-kbbnd-'+newNum); | |
$('#txtbxUrunAdi').val('M-KBBND-'+newNum); | |
$('#cphPageContent_txtbxStokKodu').val('M-KBBND-'+newNum); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keyboard | |
import time | |
import random | |
# number = 1 | |
number = int(input('en son kac yazilmis: ')) | |
time.sleep(3) | |
def onkeypress(event): | |
global number |
Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.
You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::get('test', function () { | |
$raw = \DB::raw('count(*) as total'); | |
$requestCounts = \App\Models\Cards::query()->select('card_slug', $raw)->havingRaw('COUNT(*) > 1')->groupBy('card_slug')->limit(500)->pluck('total', 'card_slug'); | |
if (ob_get_level() == 0) ob_start(); | |
foreach ($requestCounts as $key => $val) { | |
echo $key . ' - ' . $val . '<br>'; | |
$ids = \App\Models\Cards::where('card_slug', $key)->pluck('id'); | |
unset($ids[0]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array = ['a', 'b', 'c']; | |
if (ob_get_level() == 0) ob_start(); | |
foreach ($array as $key => $val) { | |
echo $key . ' - ' . $val . '<br>'; | |
ob_flush(); | |
flush(); | |
echo '<script>var scrollingElement = (document.scrollingElement || document.body); | |
scrollingElement.scrollTop = scrollingElement.scrollHeight;</script>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /var/www/laravel_project | |
php artisan cache:clear | |
php artisan config:clear | |
sudo service apache2 stop | |
sudo chown -R $USER:www-data storage | |
sudo chown -R $USER:www-data bootstrap/cache | |
chmod -R 775 storage | |
chmod -R 755 bootstrap/cache | |
sudo service apache2 start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
laravel'de artisan tarafından çalıştırılan cronjoblar, eventler ve joblar'ın oluşturduğu error log ile www-data tarafından çalışan dosyaların oluşturduğu error log farklı kullanıcılar tarafından yaratıldığından yazma izni hatasına sebep verebilir. | |
bu durumun kolayca önüne geçmek için iki farklı log dosyası oluşmasını sağlayabilirsiniz. bu durumda config klasörü içindeki logging.php dosyasında ufak bir değişiklik yapacağız. | |
kullandığınız driver içindeki path bölümünü | |
'path' => storage_path( | |
function_exists('posix_getpwuid') | |
&& function_exists('posix_geteuid') | |
? 'logs/laravel' | |
. '-' . php_sapi_name() |