Skip to content

Instantly share code, notes, and snippets.

View KaiCode2's full-sized avatar
🔨
Buidling

Kai Aldag KaiCode2

🔨
Buidling
View GitHub Profile
class Calculator
def addition
print "please enter the first number you want to add: "
number1 = gets.chomp
puts number1
print "please enter the secound number: "
number2 = gets.chomp
import urllib2
from urllib2 import urlopen
import re
import bs4
from bs4 import BeautifulSoup
import cookielib, urllib2
from cookielib import CookieJar
import datetime
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element, tostring, SubElement
@KaiCode2
KaiCode2 / fixPods.sh
Last active September 1, 2015 22:59
A tiny bash script to fix my pod problems
# !/bin/bash
clear
echo fear no more $USER, we are here to help
echo
echo Killing Xcode processes
kill $(ps aux | grep 'Xcode' | awk '{print $2}')
echo done
import Foundation
enum Position {
case Over
case Under
}
extension Comparable {
@KaiCode2
KaiCode2 / Cops.py
Created October 1, 2015 06:10
My fun little script that I built for an introduction to programming on the raspberry pi with a breadboard. Hook up a blue and red LED and connect them to the translating channels in the script and watch your breadboard turn into a cop car!
# Made by Kai Aldag on September 30, 2015
# Imports
import RPi.GPIO as GPIO
import sys
import time
# Setup
GPIO.setmode(GPIO.BOARD)
func dispatchOnce(_ predicate: inout Bool, _ block: @noescape () throws -> Void) rethrows {
objc_sync_enter(predicate)
defer { objc_sync_exit(predicate) }
if predicate == false {
defer { predicate = true }
try block()
}
}
public extension UIImage {
/**
Example:
```
UIImage.animationSequence(withPattern: "0XX_animation_images", swapMatching: "XX", numberOfImages: 60)
```
@param base The base string on which the animation image sequence will be generated. Note: Must have *match* embeded inside.
@param match: The pattern contained in pattern that will be substituted.
@param count: number of images to be generated. Note: Must be less than or equal to log 10 of match length.
@KaiCode2
KaiCode2 / CoreImageFacialRecognition.swift
Created October 9, 2016 20:06
Facial Recognition using CIDetector.
import UIKit
import CoreImage
extension UIImage {
/** Returns an Array of all detected faces as *UIImages.* If none are found empty Array will be returned.
- Author: Kai Aldag
*/
func findFacesInImage() throws -> [UIImage] {
@KaiCode2
KaiCode2 / HackMit2-Brute.py
Created August 1, 2017 06:15
The script I used to finish Hack Mit challenge 2. (Commented code is for part 1)
# Script for breaking HackMIT challenge 2
import requests
import threading
fail = '''
<html>
<head>
<title>Hack Store</title>
<link href="https://fonts.googleapis.com/css?family=Poppins:400,700" rel="stylesheet">
@KaiCode2
KaiCode2 / Star.swift
Created August 29, 2017 18:14
Core Graphics experiment: draw a star
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
internal final class StarView: UIView {
let numberOfEdges = 5
let fillColor: UIColor = .red
let strokeColor: UIColor = .black
let lineWidth: CGFloat = 2