Skip to content

Instantly share code, notes, and snippets.

View simrandotdev's full-sized avatar

Simran simrandotdev

View GitHub Profile
@simrandotdev
simrandotdev / getDependentPicklists.cls (2017 approach)
Created March 25, 2022 12:57 — forked from boxfoot/getDependentPicklists.cls (2017 approach)
Handle cases where one dependent option can be used for multiple controlling options
/*
* Apex doesn't expose dependent picklist info directly, but it's possible to expose.
* Approach:
* * Schema.PicklistEntry doesn't expose validFor tokens, but they are there, and can be accessed by serializing to JSON
* (and then for convenience, deserializing back into an Apex POJO)
* * validFor tokens are converted from base64 representations (e.g. gAAA) to binary (100000000000000000000)
* each character corresponds to 6 bits, determined by normal base64 encoding rules.
* * The binary bits correspond to controlling values that are active - e.g. in the example above, this dependent option
* is available for the first controlling field only.
*
@simrandotdev
simrandotdev / airports.json
Last active February 24, 2021 02:40 — forked from tdreyno/airports.json
JSON data for airports and their locations
[{
"code": "DEL",
"lat": "28.5603",
"lon": "77.1027",
"name": "Indira Gandhi International Airport",
"city": "New Delhi",
"state": "Madhya Pradesh",
"country": "India"
},
{
@simrandotdev
simrandotdev / CarrierInfo.swift
Created September 22, 2020 22:25 — forked from dfelber/CarrierInfo.swift
Get carrier info from your iOS Device
import CoreTelephony
let info: CTTelephonyNetworkInfo = CTTelephonyNetworkInfo()
guard let carrier: CTCarrier = info.subscriberCellularProvider else {
// No carrier info available
return
}
print(carrier.carrierName)
print(carrier.mobileCountryCode)
@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.

@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

@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

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}