Skip to content

Instantly share code, notes, and snippets.

View efamous's full-sized avatar
🎯
Focusing

Ehichioya Prior Famous efamous

🎯
Focusing
View GitHub Profile
@efamous
efamous / hls.sh
Created November 8, 2024 22:13 — forked from stenuto/hls.sh
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
@efamous
efamous / repo-reset.md
Created June 30, 2021 19:38 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
Install PHP 7.1
sudo update-alternatives --set php /usr/bin/php7.0
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.1
php -v
PHP 7.1 Modules list (Example)
@efamous
efamous / chunk.js
Created October 11, 2020 22:28 — forked from jozefcipa/chunk.js
Process lots of promises effectively
import chunk from 'lodash.chunk'
export const processInChunks = async (array, handlerFn, { chunkSize = 5 } = {}) => {
const result = []
for (const dataChunk of chunk(array, chunkSize)) {
result.push(...await Promise.all(dataChunk.map(handlerFn)))
}
return result
}
@efamous
efamous / json-processor.js
Created October 11, 2020 22:26 — forked from jozefcipa/json-processor.js
Process large JSON files with streams
import fs from 'fs'
import { Transform } from 'stream'
import JSONStream from 'JSONStream'
// Custom transform stream
const transformer = new Transform({
objectMode: true,
transform(jsonItem, encoding, callback) {
// your logic goes here...
// const updatedItem = {}
@efamous
efamous / add-yaml-lint.sh
Created October 4, 2020 20:35 — forked from Addono/add-yaml-lint.sh
Installs yaml-lint as a dependency and creates a pre-commit hook which invokes it using husky.
#!/bin/sh
# Add yaml-lint as a dependency
yarn add -D yaml-lint
# Add a lint script
npx json -I -f package.json -e "this.scripts.lint='yamllint *.{yaml,yml}'"
# Add husky as a dependency
yarn add -D husky