Skip to content

Instantly share code, notes, and snippets.

@xr1337
xr1337 / Code.gs
Last active Jul 2, 2020
Google script to clean up root drive folder. All files are moved to their extension( mimetype) folder
View Code.gs
/// returns extension from the file object
/// Queries the mimetype
const getExtension = function(file) {
var mime = file.getMimeType()
var docType = mime.split("/").pop()
return docType.split(".").pop()
};
/// send an email to myself when any files are moved
@xr1337
xr1337 / main.go
Created Aug 10, 2020
medical_records
View main.go
package main
import (
"encoding/json"
"fmt"
"net/http"
"sort"
"time"
)
@xr1337
xr1337 / question.swift
Created Aug 10, 2020
unique substrings
View question.swift
import Cocoa
func fewestCoins(coins: String) -> Int {
let coinsArray = Array(coins)
let checkSet :Set = Set(coinsArray)
let countedSet :NSCountedSet = NSCountedSet()
// validation when the lenght of the string == amount uniq characters
if(checkSet.count == coins.count || checkSet.count == 0) {
return coins.count
@xr1337
xr1337 / Example script to open all logs
Last active May 24, 2021
A script to stream all the logs that simulator is currently booted
View Example script to open all logs
#/bin/bash
A=`xcrun simctl list | grep Booted | perl -ne 'print "$1\n" if / \(([0-9A-Z\-]+)\) /' | sort | uniq `
for UUID in $A
do
xcrun simctl spawn $UUID log stream --level debug\
--timeout 1h\
--style compact \
--predicate 'subsystem == "my.domain.name"' &
done