Skip to content

Instantly share code, notes, and snippets.

View benjaminbojko's full-sized avatar

Benjamin Bojko benjaminbojko

View GitHub Profile
@OSDTips
OSDTips / Set-PowerPlan.ps1
Last active February 9, 2023 17:12
Set-PowerPlan.ps1
$Powerplans = Get-WmiObject -Query "SELECT ElementName,InstanceID,ISActive FROM win32_powerplan" -Namespace root\cimv2\power
$Target = "High performance"
foreach ($Powerplan in $Powerplans) {
if ($Powerplan.ElementName -eq $Target) {
$Powerplan.ElementName
$Powerplan.InstanceID
$Powerplan.ISActive
$Changer = $Powerplan
break
@alexeygrigorev
alexeygrigorev / vimeo-download.py
Created September 17, 2016 09:09
Downloading segmented video from vimeo
import requests
import base64
from tqdm import tqdm
master_json_url = 'https://178skyfiregce-a.akamaihd.net/exp=1474107106~acl=%2F142089577%2F%2A~hmac=0d9becc441fc5385462d53bf59cf019c0184690862f49b414e9a2f1c5bafbe0d/142089577/video/426274424,426274425,426274423,426274422/master.json?base64_init=1'
base_url = master_json_url[:master_json_url.rfind('/', 0, -26) + 1]
resp = requests.get(master_json_url)
content = resp.json()
@benjaminbojko
benjaminbojko / glm_quat_angle_test.h
Last active August 24, 2017 17:06
GLM Quaternion angleAxis to angle vs roll
vector<float> degs = {60, 120, 180, 240, 300, 360, 420, 480, -60, -120, -180, -240, -300, -360, -420, -480};
// angleAxis -> angle
for (float deg : degs) {
float rad = glm::radians(deg);
glm::quat rot = glm::angleAxis(rad, glm::vec3(0, 0, 1));
std::cout << "angleAxis -> angle: " + to_string(deg) + " deg -> " + to_string(glm::degrees(glm::angle(rot))) + " deg" << std::endl;
}
// angleAxis -> roll
@adielfernandez
adielfernandez / contrast.frag
Last active February 8, 2018 20:40
Simple Contrast Adjustment Shader
#version 330 core
in vec2 vTexCoord0;
out vec4 oColor;
uniform sampler2D uTex0;
uniform vec2 uResolution;
uniform float uExponent; //good values will be between 5 and 15
uniform float uShift; //good values will be between 0 and 1
@witmin
witmin / ffmpeg-mp4-to-animated-webp.md
Last active April 24, 2025 01:56
Convert MP4 file to animated WebP in ffmpeg

Convert MP4 file to animated WEBP file in ffmpeg CLI

1. Install ffmpeg CLI through homebrew

In terminal.app, install ffmpeg through homebrew

brew install ffmpeg

Validate the installation:

@sindresorhus
sindresorhus / esm-package.md
Last active May 14, 2025 06:52
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.