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 / 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 / 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 / lang_detect.md
Created August 21, 2020 15:49
If you ever need language detection
@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 / capybara.md
Created August 15, 2020 09:48
How to register a driver and instantiate using Capybara
require 'capybara'
require 'selenium-webdriver'

Capybara.register_driver :selenium_w_proxy do |app|
  proxy = Selenium::WebDriver::Proxy.new(http: 'host:port', ssl: 'host:port')
  desired_caps = Selenium::WebDriver::Remote::Capabilities.firefox
  options = Selenium::WebDriver::Firefox::Options.new
  options.add_argument('--headless') # To make the browser headless
  options.add_preference('browser.download.dir', "/some/path/to/folder/") # Custom downloads directory
@andreyuhai
andreyuhai / linux_screen.md
Last active June 25, 2020 11:00
How to scroll up/down in linux screen?

How to scroll up/down in Linux Screen?

Enter copy mode:

CTRL-A + [

Then use:

@andreyuhai
andreyuhai / date_and_time_file_name.md
Created June 24, 2020 18:41
Show Date and Time in File Name

Source

Simply put $(date +%Y-%m-%d-%H.%M.%S)

mysqldump -u <user> -p <database> | bzip2 -c > <backup>$(date +%Y-%m-%d-%H.%M.%S).sql.bz2
@andreyuhai
andreyuhai / wireshark_ssl.md
Last active June 24, 2020 10:41
Wireshark Filter for Analysis of SSL Traffic
@andreyuhai
andreyuhai / database_size.md
Created June 23, 2020 21:17
Get the size of a database
SELECT table_schema "DB Name",
        ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
FROM information_schema.tables 
GROUP BY table_schema; 

Source

@andreyuhai
andreyuhai / git_commit_only_deleted_files
Created June 20, 2020 18:41 — forked from alcidesqueiroz/git_commit_only_deleted_files
Git - Commit only deleted files...
git ls-files --deleted | xargs git rm
git commit