Skip to content

Instantly share code, notes, and snippets.

View gko's full-sized avatar
🐝
⚡️

Konstantin gko

🐝
⚡️
View GitHub Profile
@gko
gko / stream.sh
Created January 8, 2017 14:11
stream your system audio to network
#!/bin/bash
# you can find listbox `https://github.com/gko/listbox`
source ~/listbox/listbox.sh
listbox -t "Stream:" -o "$(pactl list | grep "Monitor Source" | sed -e "s/.*Monitor Source:\s//" | tr '\n' '|')" -r stream
echo ""
cvlc -vvv pulse://"$stream" --sout '#transcode{acodec=mp3,ab=128,channels=2}:standard{access=http,dst=0.0.0.0:8888/t.mp3}'
@gko
gko / project.sh
Last active January 21, 2017 14:18
create npm project both locally and on github
#!/usr/bash
# Create npm package and repo for it on github
# usage: project test
# for private repo: project -p test
project() {
while [[ $# -gt 0 ]]
do
key="$1"
@gko
gko / 01-emoji.conf
Last active April 2, 2018 21:44
Fonts config for linux(~/.config/fontconfig/conf.d/01-emoji.conf)
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- Emoji config -->
<alias>
<family>Apple Color Emoji</family>
<prefer>
<family>emoji</family>
</prefer>
</alias>
// https://twitter.com/fermatslibrary/status/875340896379817984/photo/1
const memoizedWords: {
[Key: string]: number;
} = {};
const ALPHABET_MAPPED_TO_PRIME_NUMBERS: {
[Key: string]: number;
} = {
a: 2,
b: 3,
const minute = 60;
const hour = minute * 60;
const day = hour * 24;
const week = day * 7;
const month = day * 30;
const year = day * 365;
/**
* Convert a date to a relative time string, such as
* "a minute ago", "in 2 hours", "yesterday", "3 months ago", etc.
#!/bin/bash
# This script takes a remote repository and merges it into
# the current one as a subdirectory
set -e
if [ -z "$1" ]
then
echo "Usage:"
@DarrenN
DarrenN / get-npm-package-version
Last active June 20, 2025 19:20 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@jukkatupamaki
jukkatupamaki / 20190417131115_test-setup.ts
Last active December 10, 2025 00:19
How to use Knex.js in a TypeScript project
import { Knex } from 'knex'
export async function up(knex: Knex): Promise<any> {
await knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => {
table.integer('foobar');
});
}
export async function down(knex: Knex): Promise<any> {
await knex.schema.dropTable('test_setup');
@veltman
veltman / README.md
Created September 2, 2017 12:31
SVG animation to video

Converting an SVG animation to a video with the MediaRecorder API and a hidden canvas.

Drawing frames from img elements can introduce an extra delay, so this version generates all the frames upfront and then renders them in a loop with requestAnimationFrame().

See also: Canvas animation to video

@kristoferjoseph
kristoferjoseph / single-file-web-component.html
Last active March 25, 2026 01:12
Single file Web Component
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Single File Web Component</title>
</head>
<body>
<template id=single-file>
<style>
h1 {