Skip to content

Instantly share code, notes, and snippets.

View umstek's full-sized avatar
🏠
Working from home

Wickramaranga Abeygunawardhana umstek

🏠
Working from home
View GitHub Profile
@Voldrix
Voldrix / animated_thumbnail_gen.sh
Last active August 2, 2023 09:26
Create animated thumbnail with ffmpeg in bash
#!/bin/bash
#Creates an animated thumbnail of a video clip
#This script uses scene cuts instead of fixed time intervals, and does not work well for videos with few/infrequent scene cuts
if [ -z "$1" ];then echo "Usage: <Video Files...> [outputs to same dir as input]" &>2;exit 1;fi
numOfScenes=8 #max number of scenes
sceneLength=1.5 #length of each scene in seconds
sceneDelay=1.7 #time (seconds) after a frame cut to start scene (to avoid transition effects)
for i;do
@FedericoPonzi
FedericoPonzi / CI.yml
Last active May 4, 2024 07:19
Ready to use Github workflow for cross-compiling a rust binary to many Linux architectures.
# Instruction + template repo: https://github.com/FedericoPonzi/rust-ci
# Search and replace <YOUR_BINARY_NAME> with your binary name.
name: CI
on:
pull_request:
push:
branches:
- master
tags:
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active July 24, 2024 20:54
Online Resources For Web Developers (No Downloading)
@primaryobjects
primaryobjects / m3u8.md
Last active July 26, 2024 02:06
How to download m3u8 and ts video movie streams.

m3u8 Downloading

  1. Open Chrome Developer tools and click the Network tab.
  2. Navigate to the page with the video and get it to start playing.
  3. Filter the list of files to "m3u8".
  4. Find master.m3u8 or index.m3u8 and click on it.
  5. Save the file to disk and look inside it.
  6. If the file contains a single m3u8 master url, copy that one instead.
  7. Run the program m3u8x.
  8. Paste the same m3u8 url in both textboxes (URL and Quality URL) and click "Headers" and set the referral url and user-agent from the request as found in Chrome.
@hediet
hediet / main.md
Last active July 26, 2024 22:13
Proof that TypeScript's Type System is Turing Complete
type StringBool = "true"|"false";


interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };

type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];
@bvaughn
bvaughn / react-lifecycle-cheatsheet.md
Last active March 2, 2023 13:29
React lifecycle cheatsheet

React lifecycle cheatsheet

Method Side effects1 State updates2 Example uses
Mounting
componentWillMount Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
componentWillReceiveProps Update state based on changed props
@0xjac
0xjac / private_fork.md
Last active July 27, 2024 07:07
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@ohac
ohac / Dockerfile
Created October 7, 2016 14:49
WebTorrent Hybrid Container example
FROM node
RUN apt-get update && \
apt-get install -y xvfb libgtk2.0-0 libxtst-dev libxss-dev libgconf2-dev \
libnss3 libasound2-dev && \
apt-get clean
RUN npm install webtorrent-hybrid -g
RUN mkdir work
WORKDIR work
CMD webtorrent-hybrid download \
e14cef00945a8d99dc74d65cf52dcb892cf48ed1 \
@aisouard
aisouard / readVariableInt.js
Last active May 5, 2021 09:53
Reading an EBML variable-length integer
/**
* Read an EBML tag header or length and return their respective values into
* single numbers.
*
* @example
* var tagHeader = new Uint8Array([0x1A, 0x45, 0xDF, 0xA3, 0x01, 0x00, 0x00,
* 0x00, 0x00, 0x00, 0x00, 0x1F]);
* var tagId = readVariableInt(tagHeader, 4, 0);
* console.log('The current tag ID is: ', tagId.value, ', skipping ', tagId.size, ' bytes.');
* // The current tag ID is: 172351395, skipping 4 bytes.
@MiloszKrajewski
MiloszKrajewski / GetDrives.cs
Created March 29, 2016 08:29
Get drive information (C#, Windows, WMI)
var driveQuery = new ManagementObjectSearcher("select * from Win32_DiskDrive");
foreach (ManagementObject d in driveQuery.Get())
{
var deviceId = d.Properties["DeviceId"].Value;
//Console.WriteLine("Device");
//Console.WriteLine(d);
var partitionQueryText = string.Format("associators of {{{0}}} where AssocClass = Win32_DiskDriveToDiskPartition", d.Path.RelativePath);
var partitionQuery = new ManagementObjectSearcher(partitionQueryText);
foreach (ManagementObject p in partitionQuery.Get())
{