Skip to content

Instantly share code, notes, and snippets.

View SergeiMeza's full-sized avatar

Sergei Meza SergeiMeza

View GitHub Profile
@SergeiMeza
SergeiMeza / country_codes.json
Created September 11, 2018 19:56 — forked from orenitamar/country_codes.json
Two letter country code mapping, grouped by continent/region
{
"europe": {
"va": "vatican city",
"ch": "switzerland",
"ad": "andorra",
"ee": "estonia",
"is": "iceland",
"am": "armenia",
"al": "albania",
"cz": "czech republic",
@SergeiMeza
SergeiMeza / Firecloud Nearby GeoQuery
Created September 20, 2018 12:15 — forked from zirinisp/Firecloud Nearby GeoQuery
Firecloud Nearby GeoQuery
import CoreLocation
extension CLLocationCoordinate2D {
func boundingBox(radius: CLLocationDistance) -> (max: CLLocationCoordinate2D, min: CLLocationCoordinate2D) {
// 0.0000089982311916 ~= 1m
let offset = 0.0000089982311916 * radius
let latMax = self.latitude + offset
let latMin = self.latitude - offset
// 1 degree of longitude = 111km only at equator

Videos

import Foundation
struct API {
static let baseURL = "https://shopicruit.myshopify.com/admin/"
enum GET {
case customCollections
case collects(collection_id: String)
case products(product_ids: [String])
@SergeiMeza
SergeiMeza / express-upload.ts
Created January 2, 2020 11:37
express receive file stream post request
import fs from "fs"
import express from "express"
app.post("/test-upload", async (req, res) => {
const mimetype = req.headers["content-type"]
const filename = req.headers["filename"]
prettyPrint({ mimetype, filename })
if (!mimetype || typeof mimetype !== "string") return res.status(403).send()
if (!filename || typeof filename !== "string") return res.status(403).send()
@SergeiMeza
SergeiMeza / axios-upload.ts
Created January 2, 2020 11:39
Axios post file stream
import fs from "fs"
import Axios from "axios"
async function main() {
let image = __dirname + "/image.jpg"
const stats = fs.statSync(image)
const upload = fs.createReadStream(image, { highWaterMark: 1024 * 5 }) // 5 kb/op
console.log("file size: ", stats.size / 1024, "KB")
//
// Created by Jeany Meza on 2020/03/04.
// Copyright © 2020 pestalozzitech. All rights reserved.
//
import UIKit
import UIComponents
public class TemplateViewController: UIViewController {
public init() {
//
// Created by Jeany Meza on 2020/03/04.
// Copyright © 2020 pestalozzitech. All rights reserved.
//
import UIKit
import UIComponents
public class TemplateView: UIView {
public override init(frame: CGRect) {
//
// Created by Jeany Meza on 2020/03/04.
// Copyright © 2020 pestalozzitech. All rights reserved.
//
import UIKit
import UIComponents
public class TemplateCollectionViewCell: UICollectionViewCell {
public override init(frame: CGRect) {
ffmpeg -hide_banner -i Pestalozzi_PreMovie1.0.mp4 \
-filter:v scale=w=426:h=240:force_original_aspect_ratio=decrease -profile:v baseline -b:v 400k -maxrate 425k -bufsize 600k -hls_time 10 -hls_list_size 0 -hls_segment_filename test/240p_%03d.ts test/240p.m3u8 \
-filter:v scale=w=640:h=360:force_original_aspect_ratio=decrease -profile:v baseline -b:v 700k -maxrate 770k -bufsize 1050k -hls_time 10 -hls_list_size 0 -hls_segment_filename test/360p_%03d.ts test/360p.m3u8 \
-filter:v scale=w=842:h=480:force_original_aspect_ratio=decrease -profile:v baseline -b:v 1250k -maxrate 1500k -bufsize 1875k -hls_time 10 -hls_list_size 0 -hls_segment_filename test/480p_%03d.ts test/480p.m3u8 \
-filter:v scale=w=1280:h=720:force_original_aspect_ratio=decrease -profile:v baseline -b:v 1500k -maxrate 1750k -bufsize 2250k -hls_time 10 -hls_list_size 0 -hls_segment_filename test/720p_%03d.ts test/720p.m3u8