Skip to content

Instantly share code, notes, and snippets.

View zaknesler's full-sized avatar

Zak Nesler zaknesler

View GitHub Profile
@ImTheSquid
ImTheSquid / helper.rs
Created February 20, 2023 16:17
Option<chrono::DateTime<Utc>> to Option<bson::DateTime> serialization and deserialization
pub mod chrono_datetime_option_as_bson_datetime_option {
use bson::{Bson, DateTime};
use chrono::Utc;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::result::Result;
use serde::de::Error;
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<chrono::DateTime<Utc>>, D::Error>
where
D: Deserializer<'de>,
@jepler
jepler / code.py
Last active September 19, 2021 23:41
"1D Wave" demo for circuitpython & neopixel
# CircuitPython demo - NeoPixel
import time
import board
import neopixel
import random
# Customize your neopixel configuration here...
pixel_pin = board.A1
num_pixels = const(96)
@parties
parties / renameReactJsToJsx.sh
Last active April 27, 2024 19:37
rename all *.js files containing React markup to *.jsx
# finds all *.js files that have either `</` or `/>` tags in them and renames them to *.jsx
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "</|/>" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \;
@BenSampo
BenSampo / deploy.sh
Last active April 30, 2024 03:41
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@jamesmacwhite
jamesmacwhite / ffmpeg_mkv_mp4_conversion.md
Last active May 5, 2024 15:42
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

# 10_basic.py
# 15_make_soup.py
# 20_search.py
# 25_navigation.py
# 30_edit.py
# 40_encoding.py
# 50_parse_only_part.py
@nishantmodak
nishantmodak / nginx.conf.default
Last active February 29, 2024 13:48
Default Nginx Conf
#user nobody;
#Defines which Linux system user will own and run the Nginx server
worker_processes 1;
#Referes to single threaded process. Generally set to be equal to the number of CPUs or cores.
#error_log logs/error.log; #error_log logs/error.log notice;
#Specifies the file where server logs.