Skip to content

Instantly share code, notes, and snippets.

View jmeline's full-sized avatar

Jacob Meline jmeline

  • Software Developer @ DriveTime
  • Greater Salt Lake City
View GitHub Profile
@jmeline
jmeline / download-file-axios-nodejs.js
Created June 2, 2023 05:28 — forked from senthilmpro/download-file-axios-nodejs.js
Download File using axios : Node.js program
'use strict'
const Fs = require('fs')
const Path = require('path')
const Axios = require('axios')
async function downloadImage () {
const url = 'https://unsplash.com/photos/AaEQmoufHLk/download?force=true'
const path = Path.resolve(__dirname, 'images', 'code1.jpg')
@jmeline
jmeline / Benchmark.cs
Last active July 27, 2022 19:50
Testing out memory cache vs lazycache
[MemoryDiagnoser(false)]
public class Benchmarks
{
private readonly IAppCache _appCache = new CachingService();
private readonly IMemoryCache _memoryCache = new MemoryCache(new MemoryCacheOptions());
[Benchmark]
public int GetOrCreate_MemoryCache() =>
_memoryCache.GetOrCreate("set", _ => 100);
[Benchmark]
@jmeline
jmeline / ffmpeg.md
Created September 6, 2021 01:05 — forked from protrolium/ffmpeg.md
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@jmeline
jmeline / carrier_onboarding_AuthenticationExtension.cs
Last active June 29, 2021 21:50
Dotnet - Authentication - How to do an Auth0 Redirect
namespace CarrierOnboarding.Mfe.Infrastructure
{
public static class AuthenticationExtensions
{
public static AuthenticationBuilder AddMktpCookieAuthentication(this IServiceCollection services)
{
void DefaultOptions(AuthenticationOptions options)
{
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
@jmeline
jmeline / ThreadModeling.md
Last active March 18, 2021 23:01
Security 2021 - Threat Modeling

Threat Modeling

Systematically listing all the potential ways one can attack an application

You look at the application at a whole

  • Systematically: repeatable process. Repeatable and consistent process
  • Attack: Look for what can be abused or attacked
  • Probably threat scenarios && list of threats
@jmeline
jmeline / readme.md
Created November 3, 2020 20:30 — forked from noahcoad/readme.md
Code Minecraft with Python on Mac OSX

Code Minecraft with Python on Mac OSX

Here's a step-by-step to get started scripting Minecraft with Python on Mac OSX

@jmeline
jmeline / SingleArrow.ipynb
Created August 23, 2019 15:45 — forked from vakila/SingleArrow.ipynb
Anjana Vakil, "The Universe in a Single Arrow", JSHeroes 2019
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmeline
jmeline / Extensions.cs
Created July 10, 2019 06:06
Compose in C#
using System;
namespace FunCSharp
{
public static class Extensions
{
// x => f(g(x))
public static Func<T1, T3> ComposeWith<T1, T2, T3>(this Func<T2, T3> f, Func<T1, T2> g)
{
return x => f(g(x));
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]