Skip to content

Instantly share code, notes, and snippets.

View RickyAvina's full-sized avatar
🎯
Focusing

Enrique Avina RickyAvina

🎯
Focusing
  • Boston, MA
View GitHub Profile
@RickyAvina
RickyAvina / SwiftBorderExtension.swift
Created August 30, 2022 19:24
Add a border to a specific set of edges of a view
extension View {
func border(width: CGFloat, edges: [Edge], color: Color) -> some View {
overlay(EdgeBorder(width: width, edges: edges).foregroundColor(color))
}
}
struct EdgeBorder: Shape {
var width: CGFloat
var edges: [Edge]
@RickyAvina
RickyAvina / TimeFromExtension.swift
Created August 10, 2022 19:09
Time-From Date Formatter (TwitterLike)
func timeFromNow(date: Date) -> String {
let dateTransformed = date.addingTimeInterval(TimeInterval(60))
let diffComponents = Calendar.current.dateComponents([.day, .hour, .minute], from: Date.now, to: dateTransformed)
guard let day = diffComponents.day else {
print("error decoding time")
return ""
}
if day > 0 {
/*
* Copyright (c) 2020 Razeware LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@RickyAvina
RickyAvina / download_google_images.py
Created May 28, 2020 19:14
Download Google Images
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import sys
import os
import requests
import urllib3
from urllib3.exceptions import InsecureRequestWarning
import time
from tqdm import trange
cd path/to/your/app
php -S localhost:8000
@RickyAvina
RickyAvina / ScanManager.cs
Created January 20, 2019 18:18 — forked from sGambolati/ScanManager.cs
SpatialDemo's Final ScanManager.cs file.
using System;
using HoloToolkit.Unity;
using HoloToolkit.Unity.InputModule;
using UnityEngine;
public class ScanManager : MonoBehaviour, IInputClickHandler
{
public TextMesh InstructionTextMesh;
public Transform FloorPrefab;
public Transform WallPrefab;
@RickyAvina
RickyAvina / jpgToPng.sh
Created February 3, 2018 21:06
JpgToPng for bash terminal
for file in *.txt; do mv "$file" "${file%.txt}.py"; done
@RickyAvina
RickyAvina / Change Format
Created July 6, 2017 20:57
Change JPEG to PNG using Mogrift
mogrify -format png *.jpeg
@RickyAvina
RickyAvina / killAllDockerInstances.bash
Created June 30, 2017 15:54
Kills and Removes all Docker instances. Great for naming conflicts or old containers.
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
@RickyAvina
RickyAvina / runDIGITSDocker.bash
Created June 30, 2017 15:49
Runs Docker for Digits on localhost:5000 using local folder "opt/ped" and making Docker alias "/data/ped"
nvidia-docker run --name digits -d -p 5000:5000 -v /opt/ped:/data/ped nvidia/digits