Skip to content

Instantly share code, notes, and snippets.

View rigelk's full-sized avatar
☄️
Sinking in

Rigel Kent rigelk

☄️
Sinking in
View GitHub Profile
@rigelk
rigelk / spec-mastodon.json
Created September 11, 2019 09:33
Spec test for @w3c-socialcg-aptf/apcomponents
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"owl": "http://www.w3.org/2002/07/owl#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"schema": "http://schema.org/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
HotkeyModule.forRoot({
cheatSheetCloseEsc: true,
cheatSheetDescription: this.i18n('Show / hide this help menu')
})
@rigelk
rigelk / utils.ts
Created October 3, 2018 12:16
getVersion
async function getVersion () {
const tag = await require('child_process')
.exec('[ ! -d .git ] || git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || true', { stdio: [0,1,2] })
if (tag) return tag.replace(/^v/, '')
const version = await require('child_process')
.exec('[ ! -d .git ] || git rev-parse --short HEAD')
if (version) return version.toString().trim()
return require('../../../package.json').version
@rigelk
rigelk / diff.patch
Created September 30, 2018 11:18
PeerTube #1135 proposal
diff --git server/helpers/ffmpeg-utils.ts server/helpers/ffmpeg-utils.ts
index ed823a67..92025092 100644
--- server/helpers/ffmpeg-utils.ts
+++ server/helpers/ffmpeg-utils.ts
@@ -116,10 +116,6 @@ type TranscodeOptions = {
function transcode (options: TranscodeOptions) {
return new Promise<void>(async (res, rej) => {
- if (options.resolution === undefined) {
- return rej('Invalid video file')
import {
ComponentFixture,
TestBed
} from '@angular/core/testing'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { RouterTestingModule } from '@angular/router/testing'
import { VideosProvider, VideoService } from '../../shared/video/video.service'
import { VideoUpdateComponent } from '../+video-edit/video-update.component'
import { VideoEditComponent } from '../+video-edit/shared/video-edit.component'
import { VideosModule } from '../videos.module'
@rigelk
rigelk / ffmpeg-utils.ts
Created July 28, 2018 09:25
check streamability
async function isVideoFileStreamable (path: string): Promise<{ [key: string]: boolean }> {
let stream = fs.createReadStream(path, {
encoding: null,
start: 0,
end: 1024 * 1024
})
const isAVC = (await getVideoFileStream(path)).filter(s => {
return s['codec_name'] === 'h264' &&
s['bit_rate'] < 3000000
@rigelk
rigelk / chrooted.sh
Created May 2, 2018 23:13 — forked from andsens/chrooted.sh
Configure server for chrooted sftp users and create those users
#!/bin/bash
# source this file in /root/.bashrc or /root/.zshrc
# Sets up the server for chrooted users
configure_chrooted() {
grep ^chrooted: /etc/group
if [[ $? == 0 ]]; then
printf "The chrooted group already exists, aborting...\n"
exit 1
/*
we check feed validity using:
- XSD for RSS 2.0 -> https://raw.githubusercontent.com/ultraq/rss-xml-generator/master/Schema/RSS-2.0.xsd
- JSON Schema for… JSON Feed -> https://raw.githubusercontent.com/sonicdoe/jsonfeed-schema/master/schema-v1.json
*/
const JSONFeedInstanceJSONSchema = require('jsonfeed-schema')
JSONFeedInstanceJSONSchema.properties.items.items.additionalProperties = true
async function loadXSD (path): Promise<string> {
@rigelk
rigelk / design-pr-template.md
Last active February 21, 2018 03:30
A template for design PRs

A few sentences describing the overall goals of the pull request’s commits.

Design Changes

Related Items

List related task, documentation, pull requests, etc.

Steps to Test or Reproduce

@rigelk
rigelk / peertube.conf
Last active April 25, 2025 21:53
a now OUTDATED httpd/Apache vhost to run PeerTube | note that only Nginx is supported by the PeerTube team, and with this or any other Apache configuration, you will likely get NO SUPPORT.
# requires WebSocket support with `a2enmod proxy_wstunnel`
# check https://ssl-config.mozilla.org/#server=apache&version=2.4.41&config=modern&openssl=1.1.1d&hsts=false&ocsp=false&guideline=5.6 for hardening security
<VirtualHost *:80 [::]:80>
ServerName peertube.example.com
ServerAdmin [email protected]
Protocols h2c http/1.1
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/