Skip to content

Instantly share code, notes, and snippets.

View dawand's full-sized avatar

Dawand Sulaiman dawand

  • Adobe
  • Edinburgh
View GitHub Profile
@dawand
dawand / Palindrome.java
Last active February 2, 2020 14:29
Happy Palindrome Day 02022020
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Stack;
public class Palindrome {
public static void main(String[] args) {
LocalDate today = LocalDate.now();
String formattedDate = today.format(DateTimeFormatter.ofPattern("ddMMyyyy"));
@dawand
dawand / download_apk.py
Last active December 9, 2023 01:46
Download APK files from Google Play Store with Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File name: download_apk.py
Author: Dawand Sulaiman
Download APK files from Google Play Store with Python
This script scraps https://apkpure.com to get the apk download link
Make sure you have BeautifulSoup and urllib libraries
"""
@dawand
dawand / KMP.swift
Created June 24, 2017 12:37
Word Count - Knuth-Morris Pratt algorithm
class KMP {
// used for KMP, Build pi function of prefixes
class func build_pi(_ str: String) -> [Int] {
let n = str.characters.count
var pi = Array(repeating: 0, count: n + 1)
var k:Int = -1
pi[0] = -1
for i in 0..<n {
//// General Declarations
CGContextRef context = UIGraphicsGetCurrentContext();
//// Color Declarations
UIColor *color = [UIColor colorWithRed:0.306 green:0.678 blue:0.604 alpha:1.0];
UIColor *shadowColor = [UIColor colorWithRed:0.20 green:0.200 blue:0.200 alpha:1.0];
NSShadow *shadow;
shadow.shadowColor = [shadowColor colorWithAlphaComponent:0.72];
shadow.shadowOffset = CGSizeMake(0.1, -0.1);
shadow.shadowBlurRadius = 5;