Skip to content

Instantly share code, notes, and snippets.

View iUsmanN's full-sized avatar
💻

Usman Nazir iUsmanN

💻
  • The Guardian
  • London
View GitHub Profile
@iUsmanN
iUsmanN / tickr-now.json
Created April 8, 2023 23:02
Featured (Ticker)
{
"now": ["London","Lahore"]
}
@iUsmanN
iUsmanN / forwardport.sh
Created March 23, 2023 23:23 — forked from debashisbarman/forwardport.sh
Forward port 80 to 8080 on EC2 instance.
sudo iptables -t nat -L
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000
@iUsmanN
iUsmanN / textOnImage.swift
Created July 25, 2021 16:57
Swift (Text On Image)
func textOnImage(drawText text: String, inImage image: UIImage, atPoint point: CGPoint) -> UIImage {
let textColor = UIColor.white
let textFont = UIFont(name: "Helvetica Bold", size: 20)!
let scale = UIScreen.main.scale
UIGraphicsBeginImageContextWithOptions(image.size, false, scale)
let textFontAttributes = [
NSAttributedString.Key.font: textFont,
NSAttributedString.Key.foregroundColor: textColor,
@iUsmanN
iUsmanN / ViewController.swift
Created August 2, 2019 09:25
Uses iOS AV Audio Engine to record and play sounds from the mic
/// Originally Created by Tadashi on 2017/03/02.
/// Commented by Usman Nazir
//IMPT
//ADD A INDICATOR VIEW TO THE SCREEN AND LINK HERE TO AVOID CRASHES ALONG WITH A PLAY AND RECORD BUTTON
import UIKit
import AVFoundation
import AudioToolbox