Skip to content

Instantly share code, notes, and snippets.

View aessam's full-sized avatar
:octocat:
Doing code pushups

Ahmed Essam aessam

:octocat:
Doing code pushups
View GitHub Profile
import requests
def lookup_podcasts(search_term):
base_url = "https://itunes.apple.com/search"
params = {
"term": search_term,
"media": "podcast",
"limit": 10 # Adjust the limit as needed
}
@aessam
aessam / WorkDiary.md
Created February 18, 2023 23:24
A Template for a work diary that I do weekly, sharing it, incase it is helpful.

This Week plan

  • What I Am planing to do this week
    • Complete Big Task 1123
    • Big Task 2123

What Happened Last Week

  • Last week plan
    • Big Task 1
    • Big Task 1123
@aessam
aessam / Circles.swift
Created February 17, 2021 00:34
Drawing segments of a circle in SwiftUI
import SwiftUI
extension Color {
static var random: Color {
return Color(
red: .random(in: 0...1),
green: .random(in: 0...1),
blue: .random(in: 0...1)
)
}
@aessam
aessam / Picture-n-Picture.js
Created November 29, 2020 15:17
Control browser's video Speed (booklet)
javascript:(function()%7Bvar%20video%20%3D%20document.getElementsByTagName('video')%5B0%5D%3Bvideo.play()%3Bvideo.webkitSetPresentationMode(video.webkitPresentationMode%20%3D%3D%3D%20%22picture-in-picture%22%20%3F%20%22inline%22%20%3A%20%22picture-in-picture%22)%7D)()
@aessam
aessam / TakeBGOut.py
Created August 9, 2020 17:34
This is a quick script to extract background from image, it is based on lowpass filter
from PIL import Image, ImageDraw
import random
from sys import argv
image_name = ""
if len(argv) != 4:
print("My have input, output and factor")
exit()
else:
@aessam
aessam / windowShot.py
Last active May 2, 2020 10:47
Take a screenshot for a window, query by window title (windowShot.py 'Mail') output to tmp directory.
import os
from sys import argv
from Quartz import CGWindowListCopyWindowInfo, kCGWindowListExcludeDesktopElements, kCGNullWindowID,kCGWindowListOptionOnScreenOnly
windowList = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID)
systemWindows = ['SystemUIServer', 'Window Server', 'Spotlight']
searchname = argv[1].lower()
for i in windowList:
if searchname in i['kCGWindowOwnerName'].lower() and i['kCGWindowOwnerName'] not in systemWindows:
print(i['kCGWindowNumber'], i['kCGWindowOwnerName'])
os.system('screencapture -l{0} "tmp/{0}{1}.png"'.format(i['kCGWindowNumber'], i['kCGWindowOwnerName']))
@aessam
aessam / fullColorASCII.py
Created March 8, 2020 23:35
Not ASCII art.
from PIL import Image, ImageDraw
import sys
def rgb_2_pixels(fr, fg, fb, br, bg, bb, text='\u2584'):
fgc = "{0};{1};{2}".format(fr, fg, fb)
bgc = "{0};{1};{2}".format(br, bg, bb)
return "\033[38;2;{0};48;2;{1}m{2}\033[0m".format(fgc, bgc, text)
def morph_color(c1, c2):
return int((c1 + c2) / 2)
@aessam
aessam / helpers.swift
Created August 18, 2019 02:40 — forked from kastiglione/helpers.swift
Swift helpers, and the lldb setup to use them. Presented @ SLUG https://speakerdeck.com/kastiglione/advanced-debugging-and-swift
extension UIView {
/// Example: call someView.nudge(0, 30)
func nudge(_ dx: CGFloat, _ dy: CGFloat) {
self.frame = self.frame.offsetBy(dx: dx, dy: dy)
CATransaction.flush()
}
}
extension UIView {
/// Example: po UIView.root
@aessam
aessam / MatHeart.py
Last active February 23, 2019 01:51
Drawing heart with math
# http://mathworld.wolfram.com/HeartCurve.html
from math import pi, sin, cos
import time
import numpy as np
r = 1
result = []
for i in range(38):
result.append([])
result[i] = list(map(lambda x: ' ', range(38)))
@aessam
aessam / ApplyFilter.py
Last active March 31, 2019 22:47
I was trying to understand how convolutional network works with filters, I decided to replicate it.
from PIL import Image, ImageDraw
import random
from sys import argv
if len(argv) != 3:
print("<<script>> Image outputDir")
exit(1)
image_name = argv[1]
out = argv[2]