Skip to content

Instantly share code, notes, and snippets.

@LorenzoBloedow
LorenzoBloedow / fixRelativeImports.cjs
Last active June 17, 2023 17:34
Node.js Script to Fix Relative Imports of a File
const fs = require("fs");
const path = require("path");
const chalk = require("chalk");
/**
ARGUMENTS:
(-P | --paths): Comma-separated list of base paths. All files under these paths will be fixed.
(-I | --import-paths): Comma-separated list of import paths. All files under these paths will be used when searching for imports.
If not provided, the paths from (-P | --paths) will be used.
(-D | --dry-run): Prints the results but doesn't actually write them to the files.
@mohd-akram
mohd-akram / icloud-download
Created September 22, 2020 19:56
A script to download files and directories from iCloud Drive
#!/usr/bin/env python3
# Install
# 1. Install dependency: `pip3 install --user pyicloud`
# 2. Sign in to iCloud: `icloud --username your@email.com`
# 3. Copy file to somewhere in your `PATH`
# 4. Add `alias icloud-download="ICLOUD_EMAIL=your@email.com icloud-download"`
# to ~/.profile or ~/.bashrc, etc
# 5. Use via eg. `icloud-download Documents/folder`
# which will download `folder` to your current directory
@danylokos
danylokos / converter.py
Created December 5, 2019 20:56
Converts Keras .h5 model to CoreML .mlmodel'
#!/usr/bin/env python
'''
./converter.py \
--model model.h5 \
--desc "Predicts either a phone is in the hands or in a pocket" \
--input_desc "Sensor samples (acc, gyro, mag, 50Hz)" \
--output_desc "1 - phone in the hands, 0 - phone in a pocket" \
--author "Danylo Kostyshyn" \
--license="MIT"
@skokenes
skokenes / index.js
Created September 26, 2019 14:25
SVG Path Generator for Rounded Rectangles
function createRoundedRectPath(x, y, width, height, radius) {
return (
// Move to position, offset by radius in x direction
"M" +(x + radius) + "," + y
// Draw a horizontal line to the top right curve start
+ "h" + (width - 2 * radius)
// Draw the top right corner curve
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius
// Draw a vertical line to the bottom right corner
+ "v" + (height - 2 * radius)
@scmx
scmx / update-diverged-branch-with-git-checkout-B.md
Created April 7, 2017 07:01
Updating a local diverged git branch to latest remote without reset --hard. #git git checkout -B vs git reset --hard

Updating a local diverged git branch to latest remote without reset --hard

Sometimes you have a branch checked out locally that someone else owns and they do a force push. Perhaps it's during a review when they have pushed all the needed fixups and got them approved. So now they squash and force-push the branch. It's time for you to take a new look at the updated commits, so you checkout the branch and try to update it.

The situation

$ git checkout some-topic-branch
$ git pull
@tayvano
tayvano / gist:6e2d456a9897f55025e25035478a3a50
Created February 19, 2017 05:29
complete list of ffmpeg flags / commands
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active September 23, 2025 21:29
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@whitingx
whitingx / meta-tags.md
Created October 5, 2012 16:41 — forked from kevinSuttle/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>