Skip to content

Instantly share code, notes, and snippets.

View ravshansbox's full-sized avatar

ravshansbox

View GitHub Profile
@ravshansbox
ravshansbox / gh-set-upstream.sh
Created June 7, 2026 15:04
After cloning a GitHub fork, set 'upstream' remote to the original parent repo. Tiny, no gh repo set-default needed.
#!/usr/bin/env bash
set -euo pipefail
slug=$(git remote get-url origin | sed -E 's#^.*[/:]([^/]+/[^/.]+)(\.git)?$#\1#')
url=$(gh api "repos/$slug" --template '{{if .fork}}{{.parent.ssh_url}}{{end}}' 2>/dev/null || true)
[[ -z $url ]] && { echo "not a fork"; exit 0; }
git remote add upstream "$url" 2>/dev/null || git remote set-url upstream "$url"
git fetch upstream --prune
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
const http = require('node:http');
const https = require('node:https');
const target = 'example.com';
const corsHeaders = { 'access-control-allow-origin': '*' };
const server = http.createServer((request, response) => {
if (request.method === 'OPTIONS') {
response.writeHead(200, corsHeaders);
response.end();
List me all versions of webos and tizen for the last 5 years with respective chromium versions.
# WebOS and Tizen Versions with Chromium (Last 5 Years)
## WebOS
| WebOS Version | Release Date | Chromium Version |
|---------------|--------------|------------------|
| webOS 6.0 | 2021 | Chromium 79 |
| webOS 6.5 | 2022 | Chromium 87 |
#!/usr/bin/env python3
import fontforge
import sys
if len(sys.argv) < 3:
print("Usage: python remove_calt.py input_font output_font")
sys.exit(1)
input_font = sys.argv[1]
output_font = sys.argv[2]
import fs from 'node:fs';
fs.readdirSync('./in')
.map((file) => {
const name = file
.replace(/\.(otf|ttf)/, '')
.match(/[A-Z][a-z]+/g)
.join(' ');
return `/FontPatcher/font-patcher --outputdir ./out --name "${name}" --complete --mono ./in/${file};`;
})
@ravshansbox
ravshansbox / .vimrc
Last active February 20, 2025 02:19
set cursorline
set expandtab
set hlsearch
set incsearch
set laststatus=2
set noshowmode
set number
set shiftwidth=2
set tabstop=2
set viminfo=
#!/usr/bin/fontforge
import fontforge
import sys
# Check if input and output paths are provided
if len(sys.argv) < 3:
print("Usage: fontforge -script remove_features.py input.ttf output.ttf")
sys.exit(1)
input_font = sys.argv[1]
import fontforge
import sys
import math
if len(sys.argv) != 8:
print("Usage: python italicize.py <input-font> <output-font> <font-name> <family-name> <full-name> <font-weight> <italic-degree>")
sys.exit(1)
input_font = sys.argv[1]
output_font = sys.argv[2]
import fontforge
import sys
def increase_line_spacing(input_font, output_font, increase_factor):
font = fontforge.open(input_font)
# Store the original values
original_em = font.em
original_ascent = font.ascent
original_descent = font.descent