Skip to content

Instantly share code, notes, and snippets.

View andreyuhai's full-sized avatar
🏠
Working from home

Burak andreyuhai

🏠
Working from home
View GitHub Profile
@andreyuhai
andreyuhai / grub.md
Last active September 6, 2020 08:11
backlight fix ubuntu

/etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"

sudo update-grub

if this does not work then try

/etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=video"

@andreyuhai
andreyuhai / avg_compare.sql
Created December 4, 2018 14:12
Compare AVG with some other cell
select
cust_id,
gender,
weight
from customer c
WHERE weight > (SELECT AVG(weight)
FROM customer
WHERE gender = c.gender)
order by c.gender
@andreyuhai
andreyuhai / case_usage.sql
Created December 4, 2018 14:13
How to use CASE in MS SQL
WITH Orders (customerID, orderNum) AS
(
SELECT CustomerID, COUNT(*) 'number of orders'
FROM Sales.SalesOrderHeader
GROUP BY CustomerID
)
SELECT customerID, 'Value' =
CASE
WHEN orderNum > (SELECT (AVG(CAST(orderNum AS FLOAT)))
FROM Orders
@andreyuhai
andreyuhai / apache2.md
Last active January 8, 2019 23:54
apache2 change the root directory to any other

How to change Apache's root directory to some other directory

You'll have to edit apache2.conf and 000-default.conf to change the document root of apache.

The Apache server is installed on var/www/html.This is the default root directory of apache.

Either change the root directory of Apache or move the project to /var/www/html.

To change Apache's root directory, run:

@andreyuhai
andreyuhai / composer_laravel.md
Last active January 8, 2019 23:48
Creating projects with composer

How to create laravel projects

To create laravel dependent projects using composer:

composer create-project laravel/laravel your_project_name --prefer-dist

@andreyuhai
andreyuhai / card_columns.html
Created December 9, 2018 21:19
Card columns bootstrap
<div class="card-columns">
<div class="card">
<img class="card-img-top" src="..." alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Card title that wraps to a new line</h5>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
<div class="card p-3">
<blockquote class="blockquote mb-0 card-body">
@andreyuhai
andreyuhai / App.java
Last active January 6, 2019 03:04
How to get a button do more than one action in Java
// Just set the action command and test it in the action listener
// Once clicked this button below it pauses the thread, and when clicked once again it notifies thread to resume. Kinda start/stop
pauseButton.addActionListener(e -> {
if (e.getActionCommand().equals("resume")) {
accountCheckerBot.setRunning(true);
pauseButton.setActionCommand("pause");
pauseButton.setText("Pause");
synchronized (accountCheckerBot) {
accountCheckerBot.notify();
}
@andreyuhai
andreyuhai / sync_forked_repo.md
Last active January 8, 2019 23:46
How to sync a forked repo with the original one

How to sync a forked repo with the original one

First add your upstream

git remote -v

git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

git remote -v

@andreyuhai
andreyuhai / alias_laravel_project.md
Last active January 8, 2019 23:47
How to setup an alias for laravel project

How to set up an alias for your laravel project in a folder other than /var/www/html

Put your alias configuration in /etc/apache2/mods-enable/alias.conf

Alias /alias "/home/user/your_laravel_project_folder_/public"

    <Directory "/home/user/your_laravel_project_folder_/public">
            Options Indexes FollowSymLinks Includes ExecCGI MultiViews
            AllowOverride All

Require all granted

@andreyuhai
andreyuhai / php_artisan.md
Last active January 9, 2019 09:18
How to create a controller and model with php artisan

How to create a controller and model with php artisan

To create a controller with php artisan just type

php artisan make:controller YourController

If you want to create your controller with resources ( index, update, edit, store...) then

php artisan make:controller YourController --resource