Skip to content

Instantly share code, notes, and snippets.

View juliendargelos's full-sized avatar
🌫️

Julien Dargelos juliendargelos

🌫️
View GitHub Profile
@juliendargelos
juliendargelos / prevent-mac-os-mission-control-from-randomly-switching-desktop-space.md
Created September 22, 2022 12:16
Prevent Mac OS mission control from randomly switching desktop space.

For years I had been driven insane by Mac OS switching the current desktop space for no reason. Thanks to this post my problem is finally solved.

Here is the instant fix that worked for me:

defaults write com.apple.Dock workspaces-auto-swoosh -bool NO
defaults write -g AppleSpacesSwitchOnActivate -bool false
killall Dock
@juliendargelos
juliendargelos / remove-change-extension.sh
Created June 30, 2022 12:01
Remove or change a file extension in a bash string
file=index.js
"${file%.*}.html"
@juliendargelos
juliendargelos / scale-vec2-buffer-array.js
Last active August 2, 2021 20:32
Arithmetic mapping function that scales a vec2 buffer array
/**
* Creates a mapping function that scales a vec2 buffer array
*
* @param {number} x x scale
* @param {number} y y scale
* @return {function} method to pass to Array.prototype.map
*
* @example
*
* [
@juliendargelos
juliendargelos / _test-spritesheets.md
Last active July 29, 2021 15:32
Test spritesheets created with Sketch and Free Texture Packer.

Test spritesheets

In order to implement a spritesheet system for free texture packer, I needed test sprites that I can use to create spritesheets with different configurations. I couldn't find anything satisfactory on the web so I did it myself and chose to share my source and export files.

Files

  • sprites.zip
    Raw sprites exported from Sketch as single png files

  • spritesheet-rotated.json

@juliendargelos
juliendargelos / ffmpeg-change-volume.sh
Created June 1, 2021 13:02
FFmpeg command that changes audio volume by factor or relative dB value.
ffmpeg -i input.mp3 -filter:a "volume=0.5" output.mp3
ffmpeg -i input.mp3 -filter:a "volume=5dB" output.mp3
ffmpeg -i input.mp3 -filter:a "volume=-5dB" output.mp3
@juliendargelos
juliendargelos / remove-all-from-docker.sh
Created February 21, 2021 21:37 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@juliendargelos
juliendargelos / imagemagick-gif-from-frames.sh
Last active June 1, 2021 13:04
Imagemagick command that creates a gif from a list of frames.
convert -delay 4 -loop 0 *.png output.gif
# Order the input files by naming them with increasing numbers including leading zeros.
#
# delay (centiseconds):
# 25fps <=> 4
# 30fps <=> 3.33333
# 60fps <=> 1.66667
#
# loop: number of times to cycle through the sequence or 0 for infinity
@juliendargelos
juliendargelos / xcode-freespace.sh
Created July 23, 2020 11:27
Fabio Giolito's Xcode "freespace" alias
# https://twitter.com/fabiogiolito/status/933339627859185664
sudo rm -rf /.DocumentRevisions-V100/
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Developer/Xcode/Archives
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport
rm -rf ~/Library/Developer/Xcode/watchOS\ DeviceSupport
rm -rf ~/Library/Developer/Xcode/tvOS\ DeviceSupport
rm -rf ~/Library/Caches/com.apple.dt.Xcode
xcrun simctl delete unavailable
// Factorielle de n
const f = n => n === 0 ? 1 : n * f(n - 1)
// Coefficient binomial (nombre de parties de k éléments dans un ensemble de n éléments)
const c = (n, k) => f(n) / (f(k) * f(n - k))
function bezier(t, points) {
const n = points.length - 1
const o = 1 - t
@juliendargelos
juliendargelos / three-arc-edged-path.ts
Created January 23, 2020 09:40
Create 2D arc-edged path from a list of points and radii (wip)
import { Vector2, Path } from 'three'
export function arcEdgedPath(
path: Path,
points: Vector2[],
radius: number,
close?: boolean
): void
export function arcEdgedPath(