Skip to content

Instantly share code, notes, and snippets.

View jessearmand's full-sized avatar

Jesse Armand jessearmand

View GitHub Profile
@jessearmand
jessearmand / hdzeroTStoMP4.sh
Last active February 18, 2024 13:05
Convert HDZero DVR ts format to mp4 with H265 codec
#!/usr/bin/env sh
# Check if exactly 2 arguments are given
if [ "$#" -ne 2 ]; then
echo "Usage: $0 input_filename.ts output_filename.mp4"
exit 1
fi
input_file="$1"
output_file="$2"
@jessearmand
jessearmand / bing_parse_latlon.rs
Last active March 25, 2023 08:08
parse_latlon (Generated by Bing)
use exif::{DateTime, Field, Reader};
use regex::Regex;
use std::env;
use std::fs::File;
use std::io::{BufReader, Error};
use std::path::PathBuf;
use walkdir::WalkDir;
fn main() -> Result<(), Error> {
let re = Regex::new(r"\.(jpg|jpeg|png|gif|mp4|mov)$").unwrap();
@jessearmand
jessearmand / parse_latlon.rs
Last active March 25, 2023 08:11
Parse latitude longitude information from Exif tag for files in a directory (initial boilerplate from you.com, improved with kamadak-exif sample code)
use std::env;
use std::fs;
use std::fs::File;
use std::io::BufReader;
use std::path::PathBuf;
use exif::{In, Reader, Tag};
fn main() {
let args: Vec<String> = env::args().collect();
@jessearmand
jessearmand / Mutation.swift
Created March 23, 2019 13:30
To test class mutation in Swift. The same behaviour as Kotlin, when the class has mutable properties
//: [Previous](@previous)
/*:
# Mutation
To test class mutation in Swift.
The same behaviour as Kotlin, when the class has mutable properties.
*/
@jessearmand
jessearmand / Mutation.kt
Last active March 23, 2019 13:40
Node mutation. Testing how a class is being mutated on Kotlin.
/**
* You can edit, run, and share this code.
* play.kotlinlang.org
*/
class Node(name: String) {
var position: FloatArray = floatArrayOf(0.0f, 0.0f, 0.0f)
var rotation: FloatArray = floatArrayOf(0.0f, 0.0f, 0.0f, 0.0f)
var name: String = name
var children: Array<Node> = emptyArray()
@jessearmand
jessearmand / NSColor+isLight.h
Created May 16, 2018 03:11 — forked from kaishin/NSColor+isLight.h
Programmatically determine the perceived lightness of a color. More details on: http://robots.thoughtbot.com/closer-look-color-lightness + Online tool: http://thoughtbot.github.io/color-lightness-test/
#import <Cocoa/Cocoa.h>
@interface NSColor (isLight)
- (BOOL)isLight;
@end

Keybase proof

I hereby claim:

  • I am jessearmand on github.
  • I am jessearmand (https://keybase.io/jessearmand) on keybase.
  • I have a public key ASD5t-v5WMuSFh19tH9pKmg2hcXYuEIMY0nOOhjh7OnWxgo

To claim this, I am signing this object:

@jessearmand
jessearmand / stringhash.js
Created December 17, 2014 04:15
string-hash and normal hash
function slow_hash(str) {
var hash = 0, i, chr, len;
if (str.length === 0) return hash;
for (i = 0, len = str.length; i < len; i++) {
chr = str.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
// max of integer in javascript is 2^53
// http://stackoverflow.com/questions/307179/
import Foundation
class Answer {
let questionId = 0
let answerId = 0
let answer: String?
}
public class Question {
let questionId = 0