Skip to content

Instantly share code, notes, and snippets.

View Turn off Screen.bat
powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int PostMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::PostMessage(-1,0x0112,0xF170,2)
View download_youtube_playlist.bat
youtube-dl -o "%(playlist_index)s-%(title)s.%(ext)s" -f 22 "url_here"
View rvt_categories.json
{"locale":"uk","category_tree":[{"id":666793,"label":"Роботи","listing_shapes":[{"id":293219,"label":"Потреба"},{"id":293220,"label":"Моя допомога"}],"subcategories":[{"id":666805,"label":"IT / Розробка / Зв'язок","listing_shapes":[{"id":293219,"label":"Потреба"},{"id":293220,"label":"Моя допомога"}],"subcategories":[]},{"id":666812,"label":"Тексти / Переклади","listing_shapes":[{"id":293219,"label":"Потреба"},{"id":293220,"label":"Моя допомога"}],"subcategories":[]},{"id":667542,"label":"Прості онлайн роботи","listing_shapes":[{"id":293219,"label":"Потреба"},{"id":293220,"label":"Моя допомога"}],"subcategories":[]},{"id":666807,"label":"Дизайн / Графіка","listing_shapes":[{"id":293219,"label":"Потреба"},{"id":293220,"label":"Моя допомога"}],"subcategories":[]},{"id":666820,"label":"Перевезення / Логістика / Склад","listing_shapes":[{"id":293219,"label":"Потреба"},{"id":293220,"label":"Моя допомога"}],"subcategories":[]},{"id":666813,"label":"Проста фізична робота / Спеціальності","listing_shapes":[{"id":2932
@EugeneLoy
EugeneLoy / bping_monitor.bat
Last active Dec 15, 2021
Monitor internet connection using bping
View bping_monitor.bat
FOR /L %%N IN () DO (
timeout /t 60
bping -d -f=alarm.wav 4.2.2.4 -t=10 -n=1
)
@EugeneLoy
EugeneLoy / cheatsheets
Last active Jun 11, 2021
Cheat Sheets
View cheatsheets
Searching ---------------------------------------------------------------------
Find all files that has full filename pattern "YYY" in this rdirectory, recursive:
find . -wholename "YYY"
Find all matches of regexp "XXX" in file YYY:
grep -n -E "XXX" YYY
Find all occurences of "XXX" in all files with name "YYY" in this directory, recursive:
find . -name "YYY" -print0 | xargs -0 grep -n -F "XXX"
@EugeneLoy
EugeneLoy / performance
Last active Feb 7, 2018 — forked from jboner/latency.txt
Performance analysis numbers
View performance
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@EugeneLoy
EugeneLoy / export.py
Created Jan 19, 2018
Export cards from specific list in Trello (json) to csv
View export.py
import json
import csv
LIST_NAME = "Backlog"
INPUT_FILE = "data.json"
OUTPUT_FILE = 'data.csv'
with open(INPUT_FILE) as jsonfile:
data = json.load(jsonfile)
View .bashrc
export PS1='\[\033[01;37m\]\u@\h\[\033[01;32m\] \w $(__git_ps1 "\n[%s]")
\$\[\033[00m\] '
@EugeneLoy
EugeneLoy / main.scala
Created Mar 16, 2017
Silence Spark logging
View main.scala
import org.apache.log4j.Logger
import org.apache.log4j.Level
Logger.getLogger("org").setLevel(Level.ERROR)
Logger.getLogger("akka").setLevel(Level.ERROR)
@EugeneLoy
EugeneLoy / axline.py
Last active Nov 15, 2016
pyplot: draw a line through 1 or 2 reference points (works with scrolling)
View axline.py
import matplotlib.pyplot as plt
def axline(xdata, ydata, ax = plt.subplot(111), *args, **kwargs):
try:
x1 = xdata[0]
y1 = ydata[0]
except:
# assume first point coordinates given as numbers
x1 = float(xdata)