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 / pdf_size.md
Last active August 22, 2020 07:21
Reduce PDF Size

Compress a PDF

Source

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
  • -dPDFSETTINGS=/screen lower quality, smaller size. (72 dpi)
@andreyuhai
andreyuhai / lang_detect.md
Created August 21, 2020 15:49
If you ever need language detection
@andreyuhai
andreyuhai / serverless_error.md
Last active September 7, 2020 18:49
A fix for an error while using serverless framework

If you get an error using serverless

Source

Error: spawn /home/imin/.serverless/bin/xdg-open ENOENT
      at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
      at onErrorNT (internal/child_process.js:469:16)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
@andreyuhai
andreyuhai / crontab_audio.md
Last active September 7, 2020 18:48
How to play audio with a cron job

If you want to play audio with a cron job

Source

Get your user ID.

$ id -u <user_name>
1000

Then add the line below to crontab -e.

@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):
@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:

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

How to use unicode glyphs in i3 status bar?

Source

Install font awesome

sudo apt-get install fonts-font-awesome
@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.