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 / 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 / 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 / grep.md
Last active April 29, 2019 23:28
Grep Usage

To find differences between two files

grep -w -v -F -f

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 / 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.
@andreyuhai
andreyuhai / rbenv.md
Created July 25, 2019 09:12
Installing rbenv dependencies before installing Ruby with rbenv

sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev -y

source

@andreyuhai
andreyuhai / ssh.md
Created July 25, 2019 09:25
Add SSH-keys

Add SSH Keys After Fresh Install

chmod 600 ~/.ssh/id_rsa chmod 700 ~/.ssh

Run ssh-add on the client machine, that will add the SSH key to the agent.

Confirm with ssh-add -l (again on the client) that it was indeed added.
@andreyuhai
andreyuhai / capybara_poltergeist_crawlera_proxy.md
Last active October 25, 2019 13:45
How to use Crawlera proxy with Poltergeist/PhantomJS?

How to use Crawlera proxy with Poltergeist/PhantomJS?

require 'capybara'
require 'capybara/poltergeist'

Capybara.register_driver :poltergeist do |app|
    Capybara::Poltergeist::Driver.new(app, js_errors: false, phantomjs_options: ['--ignore-ssl-errors=true','--load-images=no', '--proxy=proxy.crawlera.com:8010', '--ssl-protocol=any'])
end
@andreyuhai
andreyuhai / full_name_regexp.md
Created November 6, 2019 19:11
Regexp matching <last_name>, <first_name> <middle_name>

Regexp matching last name, first name and middle name

"Last Name, FirstName Middle Name".match /^(?<last_name>\p{Alpha}+)[,\s]+(?<first_name>\p{Alpha}+)(?: *)(?<middle_name>.+)?$/
@andreyuhai
andreyuhai / times_table.R
Last active December 17, 2019 20:54
Times table prediction using neuralnet & caret in R
library(caret)
library(ModelMetrics)
library(recipes)
library(neuralnet)
library(sigmoid)
# Create the dataset
tt <- data.frame(multiplier = rep(1:10, times = 10), multiplicand = rep(1:10, each = 10))
tt <- cbind(tt, data.frame(product = tt$multiplier * tt$multiplicand))