Skip to content

Instantly share code, notes, and snippets.

View simrandotdev's full-sized avatar

Simran simrandotdev

View GitHub Profile

Download Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)[1] export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.

# $ youtube-dl {course_link} --cookies {path_to_cookies_file}

override func viewWillTransition(to size: CGSize,
with coordinator: UIViewControllerTransitionCoordinator) {
if UIDevice.current.orientation.isLandscape {
print("Landscape")
chatButton.removeTarget(self, action: #selector(handleChatButtonClick), for: .touchUpInside)
} else {
print("Portrait")
chatButton.addTarget(self, action: #selector(handleChatButtonClick), for: .touchUpInside)
}
}
@simrandotdev
simrandotdev / WiFiSsid.swift
Created April 9, 2018 17:12 — forked from werediver/WiFiSsid.swift
Get the connected Wi-Fi network SSID on iOS (in Swift).
import Foundation
import SystemConfiguration.CaptiveNetwork
func getWiFiSsid() -> String? {
var ssid: String?
if let interfaces = CNCopySupportedInterfaces() as NSArray? {
for interface in interfaces {
if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? {
ssid = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String
break
@simrandotdev
simrandotdev / rm_mysql.md
Created June 16, 2018 19:34 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

import UIKit
class ViewController: UIViewController {
// TOP LEFT
let view1 : UIView = {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
view.backgroundColor = .red
return view
@simrandotdev
simrandotdev / AccResponse.swift
Last active November 6, 2018 17:35
AccResponse.swift
extension Data {
// Converts JSON data to specified object
func fromJsonData<T : Decodable>(to type: T.Type) throws -> T {
return try JSONDecoder().decode(T.self, from: self)
}
}
struct AccResponse : Codable {
let acc: Acc
@simrandotdev
simrandotdev / ClassesPropertiesAndMethodsInKotlin.kt
Last active December 24, 2018 00:28
ClassesPropertiesAndMethodsInKotlin
fun main(args: Array<String>) {
val simran = Person("Simran", "Singh")
simran.greet()
simran.completeAddress("Mohali", "Punjab", zip = "160063", country = "India")
// As the 'getCompleteAddress()' is returning an Optional String, we are using 'elvis' operator to check for
// 'null' value, and if it is null than use some default method.
println(simran.getCompleteAddress() ?: "Unknown")
// Another way of doing this is using 'let' expression
simran.getCompleteAddress().let {
@simrandotdev
simrandotdev / DartPad1.dart
Created March 15, 2019 17:07
Functions in Dart
void main() {
String name = 'Simran';
int age = 28;
final double height = 1.84; // You cannot change this variable as it is declared final
var occupation = "Mobile App Developer";
dynamic weight = 90;
describe(name, age, height, occupation, weight);
describe("Jassi", 29, 1.9, "Software Engineer");
void main() {
final square = Square(side: 10.0);
print(square.area());
}
abstract class Shape {
double area();
}
class Square implements Shape {
@simrandotdev
simrandotdev / django_deploy.md
Last active April 21, 2019 05:13 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.