Skip to content

Instantly share code, notes, and snippets.

View Mohamedemad4's full-sized avatar

Mohamed Emad Mohamedemad4

View GitHub Profile
@sbn78
sbn78 / 55-bytes-of-css.md
Created September 26, 2022 11:31 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@cyrenity
cyrenity / compile-and-install-freeswitch-1.10.x-on-ubuntu.md
Last active April 8, 2025 14:13
Install FreeSWITCH 1.10.x on Ubuntu 18.04 | 20.04 | 22.04 LTS

Installing FreeSWITCH 1.10.X on Ubuntu 18.04 | 20.04 | 22.04 LTS

Introduction

FreeSWITCH is a software defined telecom stack that runs on any commodity hardware. FreeSWITCH can handle voice, video and text communication and support all popullar VoIP protocols. FreeSWITCH is flexible and modular, and can be used in any way you can imagine

This guide demonstrates how to get it install FreeSWITCH and get it up and running on a Ubuntu 20.04 LTS machine

Prerequisites

To follow along with this guide, you need one Ubuntu 20.04 LTS server which has prerequisite packages installed and configured. In order to install required packages issue following command

@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active May 3, 2025 15:01
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@agentzh
agentzh / network-namespace-demo.sh
Last active March 5, 2024 22:05
Create 2 network namespaces and bridge them and the default namespace together so that they can directly talk to each other via static IP addresses; also enable Internet access in all the namespaces via NAT.
#!/usr/bin/env bash
set -x
main_if=ens33
ping_count=1
echo 1 > /proc/sys/net/ipv4/ip_forward || exit 1
ip netns del ns1 > /dev/null 2>&1
@Mohamedemad4
Mohamedemad4 / stackexchange_tag_extract.py
Last active August 24, 2018 15:24
this scripts pulls every tag on stackexchange.com and every site related
import json
import requests
import pickle as pkl
call='https://api.stackexchange.com/2.2/tags?page={page}&order=desc&sort=popular&site={site}'
startFromPage=1
def get(url):
r=requests.get(url)
if r.status_code!=200:
return False
@joelthchao
joelthchao / demo.py
Last active August 31, 2021 18:02
Keras uses TensorBoard Callback with train_on_batch
import numpy as np
import tensorflow as tf
from keras.callbacks import TensorBoard
from keras.layers import Input, Dense
from keras.models import Model
def write_log(callback, names, logs, batch_no):
for name, value in zip(names, logs):
summary = tf.Summary()
@dpino
dpino / ns-inet.sh
Last active April 14, 2025 23:41
Setup a network namespace with Internet access
#!/usr/bin/env bash
# set -x
if [[ $EUID -ne 0 ]]; then
echo "You must be root to run this script"
exit 1
fi
# Returns all available interfaces, except "lo" and "veth*".
@subfuzion
subfuzion / curl.md
Last active April 30, 2025 20:39
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@kfatehi
kfatehi / blocking_ping.sh
Last active July 20, 2021 10:43
Bash script that will block until internet access is available and return appropriate exit value
#!/bin/bash
# Blocks until there is internet access
# Accepts optional parameters: host and retry limit
# Return non-zero if we try to exceed the retry limit
# Return zero if we have internet within the retry limit
# Usage: /pingblock.sh google.com 30
host=${1:-8.8.8.8}
max_tries=${2:-15}
num=0
@iamtekeste
iamtekeste / Download Google Drive files with WGET
Created July 8, 2015 11:00
Download Google Drive files with WGET
Download Google Drive files with WGET
Example Google Drive download link:
https://docs.google.com/open?id=[ID]
To download the file with WGET you need to use this link:
https://googledrive.com/host/[ID]
Example WGET command: