Skip to content

Instantly share code, notes, and snippets.

@yarons
yarons / resume.json
Last active May 30, 2023 07:36
resume.json
{
"basics": {
"name": "Yaron Shahrabani",
"label": "DevOps Engineer and Architect, Software localization expert",
"email": "sh.yaron@gmail.com",
"phone": "+972-54-4209-674",
"summary": "Experienced DevOps Engineer and Tech Lead passionate about cloud infrastructure, automation, stability, redundancy and efficiency.",
"website": "https://github.com/yarons",
"location": {
"city": "Ma'agan Michael",
@yarons
yarons / esp32_micropython_webserver_led.py
Last active January 4, 2023 21:06
Micropython on ESP32 running a Webserver that blinks the LED according to a parameter
# First replace SSID and PASS with yor Wi-Fi's SSID and password.
# The IP for the Webserver will appear in the console.
# In order to make the LED blink type the following
# in your Web Browser or curl:
# http://<esp32_ip>/blink=<amount>
# For example:
# http://192.168.1.50/blink=4
import socket
from machine import Pin
from time import sleep_ms
@yarons
yarons / 20-phone-connectivity.rules
Created August 24, 2017 13:45
Genmon XFCE panel to show phone battery level via adb
ACTION=="add|remove", SUBSYSTEM=="usb", ATTRS{idVendor}=="XXXX", ATTRS{idProduct}=="XXXX", RUN+="/usr/bin/su YOUR_USER_NAME /path/to/refresh-genmon-udev.sh"
# replace YOUR_USER_NAME with your actual user name (hardcoded, this is ran by root, it's possible to determin your user name
# by finding out who is the owner of xfce4-panel
# You'll also have to replace XXXX with the output from lsusb
# for example:
# Bus 001 Device 094: ID 046d:c05a Logitech, Inc. M90/M100 Optical Mouse
# After the term ID this is the code we're after, 046d is the idVendor code while c05a is the idProduct code
# Better have that hardcoded as well
# This file should be in /etc/udev/rules.d (at least on RedHat based and Arch based) and requires root permissions to edit.
@yarons
yarons / adb-battery-level.sh
Last active February 23, 2017 12:17
Battery percentage notifier
#!/bin/bash
adb shell dumpsys battery | grep level | sed "s@.*: @@"
#### Since it's a oneliner I would recommend adding it to the ~/.bashrc or ~/.bash_profile this way:
alias batt='adb shell dumpsys battery | grep level | sed "s@.*: @@"'
#### If you have many Android deviced connected to your computer you can specify which device to focus on, this way:
# First run: adb devices
# The ouptut should look like this:
@yarons
yarons / ssh-telegram.sh
Last active January 6, 2017 05:06 — forked from matriphe/ssh-telegram.sh
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
/*************
* lasers.js *
*************
*
* Time to unleash the killer lasers! Each laser will kill you
* unless you have the appropriate color. Too bad you can't
* see which color corresponds to which laser!
*/
function getRandomInt(min, max) {