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 / .vimrc
Last active October 20, 2022 06:27
Vimrc
source $VIMRUNTIME/defaults.vim
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@andreyuhai
andreyuhai / _pizza_form.html.eex
Last active July 30, 2021 22:38
Pizzapp Snippets
<%= form_for @changeset, @action, fn f -> %>
<h3>Type</h3>
<%= select f, :type, @pizza_types %>
<%= error_tag f, :type %>
<div class="form-group">
<h3>Extras</h3>
<%= for extras <- inputs_for(f, :extras) do %>
<%= for extra <- @extras do %>
<div>
@andreyuhai
andreyuhai / elixir_ecto_array_diff_fragment.md
Last active July 28, 2021 13:48
Elixir Ecto pick elements from the first array that are not in the second array

How to get the difference of two arrays in an Ecto fragment?

You might want to get the difference between two arrays to update a row in Postresql, in your Elixir/Phoenix app. Here I explain how to do it.

SELECT
  coalesce(
    (
      SELECT
@andreyuhai
andreyuhai / install-vim-airline.md
Last active April 8, 2021 10:21
Install vim-airline plugin manually

Source

When you download the latest version of vim-airline as .zip and unzip it to a temporary directory, you get a vim-airline-master directory in the temp directory. Inside vim-airline-master you'll find autoload, doc and plugin directories.

You should either copy these three directories to your ~/.vim/ if they don't yet exist (don't overwrite existing directories with same names!) or copy the contents of the aforementioned three directories to existing directories under ~/.vim/

@andreyuhai
andreyuhai / lunarlogic_io.rb
Last active March 4, 2021 16:41
Programming task solution that was asked by lunarlogic.io
# LUNARLOGIC.IO PROGRAMMING TASK
# Imagine we are organizing a Lunar dinner.
# 30 people have confirmed that they will come.
# We will all be seating at five 6-person tables (A, B, C, D, E, respectively).
# There will be 3 courses. After each course we'll change our seats.
# We'd like every person to sit with as many different people as possible throughout the dinner.
# As a bonus you may think of future similar occasions where different number of people and tables may be available.
# Write a program that would assign 30 people to their seats (A1, A2, A3, etc., up to E6) during each course with that goal in mind.

How to use unicode glyphs in i3 status bar?

Source

Install font awesome

sudo apt-get install fonts-font-awesome

How to increase and decrease the backlight on Lenovo Z500 with Ubuntu 20.04

Source

  1. Open /etc/default/grub
  2. Change
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

@andreyuhai
andreyuhai / debug_headers.md
Last active November 27, 2020 06:27
If you ever need to debug mechanize request headers

Ruby Mechanize Debug Request Headers

If you are trying to debug your headers:

Start listening on some port:

nc -kl 1234

Then just send a request to that port:

@andreyuhai
andreyuhai / test.py
Last active September 14, 2020 20:32
from vfs_appointment_finder import utils
class TestUtils:
def test_initialize_firefox_webdriver(self):
fox = utils.initialize_webdriver('firefox')
assert type(fox) == utils.webdriver.firefox.webdriver.WebDriver
fox.quit()
def test_initialize_chrome_webdriver(self):