Skip to content

Instantly share code, notes, and snippets.

View barzik's full-sized avatar

Ran Bar-Zik barzik

View GitHub Profile
@barzik
barzik / main.py
Created August 19, 2023 20:30
MQ-135 and ESP32 web server
import network
import socket
import machine
import ujson
import utime
SSID = 'NAME'
PASSWORD = 'PASSWORD'
def connect_to_wifi(ssid, password):
@barzik
barzik / RBZ-install-programs.sh
Last active May 26, 2023 08:55
My favorite mac programs
#!/bin/bash
# Install Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Reload Oh My Zsh
exec zsh
# Function to check if a command is installed
check_command_installed() {
[
{
"id": "a48e0b927d58bcd2",
"type": "tab",
"label": "Wordle Generator",
"disabled": false,
"info": "",
"env": []
},
{
@barzik
barzik / internet-monitor-node-red
Last active January 29, 2022 19:58
Internet Monitor for Raspberry Pi and Sensor HAT
[
{
"id": "fee7a583aa5c9a4b",
"type": "tab",
"label": "Internet Monitor",
"disabled": false,
"info": "",
"env": []
},
{
@barzik
barzik / load-google-analytics-in-webpack.js
Created December 20, 2018 13:24
How to load Google Analytics without Google script with webpack
const analyticsId = 'XX-XXXXXX';
window.ga = window.ga || ((...args) => (ga.q = ga.q || []).push(args));
ga('create', `UA-${analyticsId}-Y`, 'none');
const gaLoader = document.createElement('script');
gaLoader.src = 'https://www.google-analytics.com/analytics.js';
gaLoader.async = true;
document.querySelector('head').appendChild(gaLoader);
@barzik
barzik / add-ignore.js
Created November 6, 2016 15:38
Adding ignore remark for to CSS\JS files
/* eslint-disable angular/log,no-console,angular/json-functions,no-loop-func */
const fs = require('fs');
const glob = require('glob');
const pathToFiles = './src/**/*.less';
const disableString = '/* stylelint-disable */';
const files = glob.sync(pathToFiles, { cwd: './', realpath: true });
for (const file of files) {
const content = fs.readFileSync(file, 'utf8');
@barzik
barzik / pageObjectExample.js
Created September 24, 2016 07:47
Page Object Exanmple
'use strict';
var myPage = function () {
browser.driver.manage().window().maximize();
};
myPage.prototype = Object.create({}, {
loadingBarSettings: { get: function () { return element(by.xpath('//div[@class="snake-foreground"]/div[3]')); } },
productNameHeader: { get: function () { return element(by.css('h2.ng-binding')); } },
productContentOwnersButton: { get: function () { return element(by.xpath('//span[contains(@class, "my-badge-text") and text() = "Content Owners"]')); } },
@barzik
barzik / fix-all.bat
Last active August 9, 2016 09:04
bat file to eslint fix all the files in a sample project
call C:\Users\USER\AppData\Roaming\npm\eslint -c C:\PROJECT\client\.eslintrc C:\PROJECT\client\app\**\*.js --ignore-pattern *.spec.js --fix
call C:\Users\USER\AppData\Roaming\npm\eslint -c C:\PROJECT\client\.eslintrc-spec C:\PROJECT\client\app\**\*.spec.js --fix
call C:\Users\USER\AppData\Roaming\npm\eslint -c C:\PROJECT\server\.eslintrc C:\PROJECT\server\app\**\*.js --ignore-pattern *.spec.js --fix
call C:\Users\USER\AppData\Roaming\npm\eslint -c C:\PROJECT\server\.eslintrc-spec C:\PROJECT\server\app\**\*.spec.js --fix
@barzik
barzik / maxlengthescaped.js
Last active March 27, 2016 13:44
The max-length-escaped directive testing the length against escaped value. Prevent sending exceeding escaped length input to server\API that enforce size.
/**
* The max-length-escaped directive testing the length against escaped
* value. Prevent sending exceeding escaped length input to server\API that enforce size.
*
* Usage:
* <input type="text" max-length-escaped="250" /> || <textarea max-length-escaped="1000"></textarea>
*
* License: MIT
*/
@barzik
barzik / .gitconfig
Last active August 30, 2021 13:22
Recommended git alias list
#Based on http://haacked.com/archive/2014/07/28/github-flow-aliases/
[alias]
co = checkout
ec = config --global -e
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
cob = checkout -b
cm = !git add -A && git commit -m
save = "!f(){ ARG1=${1:-SAVEPOINT}; git add -A && git commit -m \"$ARG1\"; };f"
wip = !git add -u && git commit -m "WIP"