Skip to content

Instantly share code, notes, and snippets.

View Mosharush's full-sized avatar
👨‍💻
Code. Sleep. Repeat.

Moshe Harush Mosharush

👨‍💻
Code. Sleep. Repeat.
View GitHub Profile
@Mosharush
Mosharush / README.MD
Last active May 19, 2024 23:14
Import AWS Architecture into Pulumi

Import AWS into Pulumi

Overview

The export-aws-to-pulumi.sh script is a utility for importing AWS resources into Pulumi. It supports importing resources from multiple AWS regions and of multiple types, including EC2 instances, S3 buckets, RDS instances, and VPCs.

Prerequisites

  • AWS CLI installed and configured with appropriate permissions.
  • Pulumi CLI installed.
@Mosharush
Mosharush / bookmark-url.js
Created February 25, 2024 10:06
Bookmark: Conver JIRA Ticket to branch name
javascript: window._ticketDesc = document.querySelector('h1[data-testid="issue.views.issue-base.foundation.summary.heading"]').innerText.split('-')[0].trim().toLowerCase().replaceAll(' ', '-'); window._ticketId = document.querySelector('div[data-testid="issue.views.issue-base.foundation.breadcrumbs.breadcrumb-current-issue-container"]').innerText.toLowerCase(); alert(`${window._ticketId}/` + `${window._ticketDesc}`.replace(/(\-|\:)+$/mg, '').replace(/[\W_]+/mg, '-').substr(0,30));
@Mosharush
Mosharush / README.MD
Last active January 31, 2024 12:25
React Hook - Server-Sent Events (SSE)

Server-Sent Events (SSE) are commonly used in real-time applications where the server needs to push updates to the client.

Here are a few use cases:

  1. Real-time notifications: SSE can be used to push notifications to the client in real-time. For example, in a social media application, the server can push notifications about new posts, likes, comments, etc.
  2. Live news updates: In a news application, the server can push live news updates to the client.
  3. Real-time analytics: In an analytics dashboard, the server can push real-time data updates to the client.
  4. Chat applications: In a chat application, the server can push new messages to the client in real-time.
  5. Online multiplayer games: In an online multiplayer game, the server can push game state updates to the client in real-time.
  6. Stock price updates: In a stock trading application, the server can push real-time stock price updates to the client.
@Mosharush
Mosharush / functions.php
Created September 27, 2017 10:48
WordPress PolyLang translate shortcode & function - use in customizer texts
<?php
// If Polylang is active, hook function on the admin pages
if ( function_exists( 'pll_register_string' ) ) add_action( 'admin_init', 'pll_tc_strings_setup' );
function pll_tc_strings_setup() {
// Add text to Polylang's string translation panel
pll_register_string( 'fl-topbar-col1-text', 'Contact_Data', 'wipi', true );
pll_register_string( 'fl-arrow-breadcrumbs', 'arrow_mulilang', 'wipi', true );
}
function polylanguage_shortcode( $atts ) {
@Mosharush
Mosharush / .bashrc
Last active October 6, 2023 16:43
Bash Alias to run last wrong command wrote in Hebrew to the correct command :)
alias גררר="replace_hebrew_with_latin"
replace_hebrew_with_latin() {
previous_command=$(history | tail -n 1 | sed 's/^[ ]*[0-9]*[ ]*//')
latin_command=$(echo "$previous_command" | tr 'פםןוטארק׳/ףךלחיעכגדשץתצמנהבסז' 'poiuytrewq;lkjhgfdsa.,mnbvcxz')
# Display the translated command
echo "Translated Command: $latin_command"
# Ask for confirmation before executing
echo "Do you want to execute this command? [Press Enter again]"
@Mosharush
Mosharush / getClosestVueInstance.func.js
Last active June 22, 2023 19:30
Function to get closest vue instance from DOM element
export function getClosestVueInstance (elm) {
if (!elm) return;
const parentNode = elm.parentNode;
const vueInstance = parentNode?.__vue__;
return vueInstance ?? getClosestVueInstance(parentNode);
}
@Mosharush
Mosharush / makewp.php
Created October 30, 2017 13:02
Get latest Wordpress archive to server and extract files
<?php
// Function to remove folders and files
function rrmdir($dir) {
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $file)
if ($file != "." && $file != "..") rrmdir("$dir/$file");
rmdir($dir);
}
else if (file_exists($dir)) unlink($dir);
@Mosharush
Mosharush / README.md
Last active August 28, 2022 11:58
Check if the delivery status is online on a specific restaurant in Wolt

Pre-installation requirements

MacOs:

HomeBrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

Linux

espeak (text-to-speak engine)

sudo apt install espeak
@Mosharush
Mosharush / BaseIcon.vue
Last active July 7, 2021 17:36
Vue BaseIcon component - integrate with IcoMoon App
<template>
<i class="base-icon" :class="iconClass" :style="iconStyle">
<i v-for="n in paths" :class="`path${n}`" :key="icon + n"></i>
</i>
</template>
<script>
import './icons/style.scss'
import icons from './icons.json'
@Mosharush
Mosharush / README.MD
Created January 10, 2021 22:18
Tizen Browser - Samsung TV - Remote controll event codes javascript

Event codes

Remote Key Event Code
A 403
B 404
C 405
D 406
INFO 457
TTX/MIX 10200
0 - 9 48 - 57