Skip to content

Instantly share code, notes, and snippets.

@hemeda3
hemeda3 / vagrant.sh
Created February 27, 2018 17:00 — forked from dafi/vagrant.sh
Installing vagrant on Centos 6
# Install virtualbox
cd /etc/yum.repos.d/
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
sudo yum update
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo yum -y install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms
sudo yum -y install VirtualBox-4.2
@hemeda3
hemeda3 / kubedump.sh
Created January 25, 2020 01:23 — forked from negz/kubedump.sh
Dump Kubernetes cluster resources as YAML
#!/usr/bin/env bash
set -e
CONTEXT="$1"
if [[ -z ${CONTEXT} ]]; then
echo "Usage: $0 KUBE-CONTEXT"
exit 1
fi
@hemeda3
hemeda3 / emulator-install-using-avdmanager.md
Created December 24, 2020 06:24 — forked from mrk-han/emulator-install-using-avdmanager.md
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For generic skin emulator with default apis (without google apis):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-29;default;x86"

@hemeda3
hemeda3 / display-attributes-as-table.php
Created January 1, 2022 09:13 — forked from helgatheviking/display-attributes-as-table.php
Display the WooCommerce product attributes as a table element via shortcode [display_attributes]
<?php
/**
* Attributes shortcode callback.
*/
function so_39394127_attributes_shortcode( $atts ) {
global $product;
if( ! is_object( $product ) || ! $product->has_attributes() ){
@hemeda3
hemeda3 / custom-my-account-endpoint.php
Created January 9, 2022 18:44 — forked from claudiosanches/custom-my-account-endpoint.php
Example of custom My Account endpoint.
<?php
class My_Custom_My_Account_Endpoint {
/**
* Custom endpoint name.
*
* @var string
*/
public static $endpoint = 'my-custom-endpoint';
@hemeda3
hemeda3 / README.md
Created February 7, 2022 01:39 — forked from wuriyanto48/README.md
Kafka, Redis, Elastic Search, Mongodb with docker compose

Run

$ docker-compose up

A simple Docker and Docker Compose install script for Ubuntu

Usage

  1. sh install-docker.sh
  2. log out
  3. log back in

Links

#!/bin/bash
# This script requires jq, a command line to to parse and format JSon.
# https://stedolan.github.io/jq/
function padBase64 {
STR=$1
MOD=$((${#STR}%4))
if [ $MOD -eq 1 ]; then
STR="${STR}="
@hemeda3
hemeda3 / memoize-until.js
Created June 2, 2022 08:39 — forked from bezhermoso/memoize-until.js
`memoizeUntil` -- memoize function for n milliseconds
var R = require("ramda");
var memoizeUntil = function (fn, expiry) {
var cache = {};
var onExpiry = [];
var onCache = [];
var onCachedResult = [];
var memoized = function () {
@hemeda3
hemeda3 / mongodb-groupby-week-unwind-array-withoutFieldNames
Last active September 29, 2022 02:26
MongoDB+NodeJs script, that take string date convert it to ISO date, then extract ISO week number then count total per weekNo then calc average, then convert weeknumber to date range for readability
```javascript
var mongoose = require('mongoose');
//Set up default mongoose connection
async function calcSumByWeek() {
const weeklypipeline = [