Skip to content

Instantly share code, notes, and snippets.

View Mohamedemad4's full-sized avatar

Mohamed Emad Mohamedemad4

View GitHub Profile
@Mohamedemad4
Mohamedemad4 / word2vec_hello_world.py
Created April 23, 2017 11:21
this script resmbels a quick intro to googles word2vec wrapper
#!/usr/bin/python
#this script resmbels a quick intro to googles word2vec wrapper found in https://github.com/danielfrg/word2vec
#you can download text8 from :http://mattmahoney.net/dc/text8.zip
#word2vec description :https://code.google.com/archive/p/word2vec/
import time
import word2vec
from math import sqrt
def euclidean_distance(x,y):
@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
@Mohamedemad4
Mohamedemad4 / tags.txt
Created July 18, 2017 16:54
a collection of keywords about every topic on stackexchange seprated by commas
opengl-es-3.0,susy-sass,jsonlite,coefficients,graph-tool,browser-feature-detection,youtube-data-api-v3,pyautogui,webpack-hmr,syntaxnet,google-developers-console,reactive,nativelibrary,minidump,server-configuration,sp-send-dbmail,webmethods,griffon,hud,webresource.axd,tstringlist,hardlink,james,schema-design,byref,error-correction,zend-framework-mvc,freeimage,extended-ascii,3nf,junction-table,nssplitview,nstoolbar,difflib,binary-compatibility,listfield,outlook-2003,event-propagation,dsa,formclosing,lwip,jekyll-extensions,avalonedit,aero-glass,name-lookup,diazo,mfcc,java-compiler-api,ld-preload,libtorrent,cocoalibspotify-2.0,amazon-glacier,flipview,test-coverage,jqlite,webjars,hubspot,animatewithduration,paypal-express,google-picker,glide,openstack-neutron,papaparse,google-vision,sonarqube-ops,laravel-passport,sid,urlrequest,real-mode,ngen,denial-of-service,pst,include-guards,misra,control-characters,unification,declarative-services,easygui,photolibrary,decompress,pic18,dxf,sunos,cmath,thumb,post-processing,nxt
@Mohamedemad4
Mohamedemad4 / Rick_and_morty_Download.py
Last active August 2, 2017 14:23
A script to get you torrents of rick and morty S03E02 as soon as the torrent is here
#!/usr/bin/python
#A script to get you torrents of rick and morty S03E02 as soon as the torrent is here
#I used http://patorjk.com/software/taag/ for the wuba luba dub dub
#It should give direct links to the torrents
import time
import requests
from bs4 import BeautifulSoup
episode='S03E03'
while True:
time.sleep(60)
@Mohamedemad4
Mohamedemad4 / secure_socket_messenger.py
Last active June 13, 2018 13:36
A Secure Messenger Application that uses python Sockets and AES encryption
#!/usr/bin/env python
#python msg.py server port keyfile
#python msg.py client server:port keyfile
#the key must be 32 chars long
import sys
import socket
from Crypto.Cipher import AES
from multiprocessing import Process
@Mohamedemad4
Mohamedemad4 / DSSIM_TD_loss.py
Last active February 8, 2018 14:53
A Timedistributed Version Difference of Structural Similarity (DSSIM loss function)
from keras.objectives import *
import keras_contrib.backend as KC
class DSSIM_TD():
def __init__(self, k1=0.01, k2=0.03, kernel_size=3, max_value=1.0,n_imgs=0):
"""
A Timedistributed Version Difference of Structural Similarity (DSSIM loss function). Clipped between 0 and 0.5
Note : You should add a regularization term like a l2 loss in addition to this one.
Note : In theano, the `kernel_size` must be a factor of the output size. So 3 could
not be the `kernel_size` for an output of 32.
@Mohamedemad4
Mohamedemad4 / run_from_mem.go
Last active May 15, 2018 17:34
A golang Script that downloads a binary executable and runs it from memory under linux
package main
import (
"os"
"os/exec"
"io/ioutil"
"net/http"
)
func main(){
if _, err := os.Stat("/dev/ram0"); err == nil {
exec.Command("mkfs.vfat","/dev/ram0","8192").Run() //exe size in bytes you can overshoot
@Mohamedemad4
Mohamedemad4 / split_video_into_Frames.py
Created June 12, 2018 12:40
splits Videos into frames with multipule mods for different needs (docs in functions) uses OpenCV and Numpy
import cv2
import numpy as np
def gen_2to1(batch_size=100+1,video_path):
"split video into 2 lowQ frams with timestamps followed by an HD frame"
vidcap = cv2.VideoCapture(video_path)
success ,image = vidcap.read()
count_x=0
count_y=0
xtempC=0

Keybase proof

I hereby claim:

  • I am mohamedemad4 on github.
  • I am mohamedemad4 (https://keybase.io/mohamedemad4) on keybase.
  • I have a public key whose fingerprint is 1A8E B5B7 5309 58EB FE7C DD15 22BE 7D0D C723 2BDF

To claim this, I am signing this object:

import os
import sys
Switch_command="""ffmpeg -i {0}.noMdata.mp3 -i {1} -map 0:0 -map 1:0 -c copy -id3v2_version 3
-metadata:s:v title='{2}' {0}.mp3"""
work_dir=sys.argv[1]
splice="Kaleo - "
artist="Kaleo"
album_name="Kaleo Singles"
cover="uis/cover.jpg"