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 / gconf2.md
Created July 25, 2019 09:02
Reconfigure

Try sudo dpkg --configure -a when you get:

gconf2 depends on default-dbus-session-bus | dbus-session-bus; however:
  Package default-dbus-session-bus is not installed.
  Package dbus-user-session which provides default-dbus-session-bus is not configured yet.
  Package dbus-session-bus is not installed.
  Package dbus-user-session which provides dbus-session-bus is not configured yet.
  Package dbus-x11 which provides dbus-session-bus is not configured yet.

Here is a way to import table content into a csv file that I've found on SO.

mysql --user=wibble --password wobble -B -e "use db; select * from vehicle_categories;" | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > vehicle_categories.csv

Reference

@andreyuhai
andreyuhai / grep.md
Last active April 29, 2019 23:28
Grep Usage

To find differences between two files

grep -w -v -F -f

@andreyuhai
andreyuhai / usb.md
Created April 3, 2019 21:46
When USB stick's size is reduced
Open command line (cmd) and type diskpart. Allow the windows to run it.

type list disk, and find the number of your USB flash disk.

type select disk X, and type the number of the USB disk instead of X.It should say that disk X is now selected.

type clean.

type create partition primary.

@andreyuhai
andreyuhai / phpmyadmin.md
Last active January 13, 2019 11:15
How to fix phpmyadmin count(): Parameter must be an array or an object that implements Countable

How to fix "count(): Parameter must be an array or an object that implements Countable" error

Just run this below command line in terminal and come back to PhpMyAdmin. Now it works fine

sudo sed -i "s/|\s*\((count(\$analyzed_sql_results\['select_expr'\]\)/| (\1)/g" /usr/share/phpmyadmin/libraries/sql.lib.php

source

@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

@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 / 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 / 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 / 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">