Skip to content

Instantly share code, notes, and snippets.

View shane-edmonds's full-sized avatar

Shane Edmonds shane-edmonds

View GitHub Profile
# How to consume Github Package private registry with yarn?
Create an .npmrc file in the same location as the package.json with this content.
```
registry=https://registry.yarnpkg.com/
@<username>:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<your auth token>
always-auth=true
@ciaranj
ciaranj / calculate-contains-window.js
Created January 24, 2019 13:06
Gist to calculate the properties of an image that has been scaled/positioned through the CSS object-fit and object-position properties
function calculateContainsWindow(image) {
var imageComputedStyle = window.getComputedStyle(image);
var imageObjectFit = imageComputedStyle.getPropertyValue("object-fit");
var coordinates = {};
var imagePositions = imageComputedStyle.getPropertyValue("object-position").split(" ");
var naturalWidth = image.naturalWidth;
var naturalHeight= image.naturalHeight;
if( image.tagName === "VIDEO" ) {
naturalWidth= image.videoWidth;
@saghul
saghul / stream.js
Last active August 24, 2024 04:29
Streaming a webcam to a Jitsi Meet room
const puppeteer = require('puppeteer');
// Streams the first webcam in the system to the specified Jitsi Meet room. Audio is currently
// not sent, but it can be easily enabled by disabling the corresponding setting in `meetArgs`.
//
// TODO
// - Detect if we are kicked from the room
// - Support authenticated deployments
//
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active November 17, 2024 04:41
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@alirobe
alirobe / reclaimWindows10.ps1
Last active November 15, 2024 12:08
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@atestu
atestu / knockout-loading.js
Last active December 18, 2015 14:39
Manage loading states in Knockout.JS! This simple trick allows you to show loading states (spinners, etc) before your data is loaded. This is very useful when you're using APIs.
var YourViewModel = function () {
var self = this;
self.thing = ko.observable('');
$.get('api/call', function (data) {
self.thing(data);
// thing is loaded,
self.loaded.thing(true);
@Elindalyne
Elindalyne / Bootstrap-EC2-Windows-CloudInit.ps1
Created February 10, 2012 16:33 — forked from Iristyle/Bootstrap-EC2-Windows-CloudInit.ps1
Bootstrap Windows EC2 node with WinRM and CloudInit for making your own AMI
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install the CloudInit.NET service, 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 R2 Core x64 and Windows 2008 SP2 x86 AMIs provided
# by Amazon
#
# To run the script, open up a PowerShell prompt as admin
# PS> Set-ExecutionPolicy Unrestricted
# PS> icm $executioncontext.InvokeCommand.NewScriptBlock((New-Object Net.WebClient).DownloadString('https://raw.github.com/gist/1672426/Bootstrap-EC2-Windows-CloudInit.ps1'))