Skip to content

Instantly share code, notes, and snippets.

View jnv's full-sized avatar

Jan Vlnas jnv

View GitHub Profile
@jnv
jnv / devenv.nix
Created July 25, 2023 10:57
devenv with Python, Poetry and libstdc++.6 somewhat working (still `devenv update` crashes with version `GLIBC_2.36` not found (required by /nix/store/...-gcc-12.3.0-lib/lib/libstdc++.so.6)
{ pkgs, lib, ... }:
{
# https://devenv.sh/packages/
packages = [
pkgs.glib
pkgs.glibc
];
languages.python.enable = true;
{
"name": "openweathermap",
"defaultService": "default",
"services": [
{
"id": "default",
"baseUrl": "https://api.openweathermap.org"
}
],
"securitySchemes": [
@jnv
jnv / srt2txt.rb
Last active November 20, 2022 16:11
Converts SRT subtitles to plain text, strips irrelevant parts. Requires gems: srt, sanitize. Created for Doctor Who text analysis project.
#!/usr/bin/env ruby
require "srt"
require "sanitize"
REJECT_LINES = [/Best watched using Open Subtitles MKV Player/,
/Subtitles downloaded from www.OpenSubtitles.org/, /^Subtitles by/,
/www.tvsubtitles.net/, /subtitling@bbc.co.uk/, /addic7ed/, /allsubs.org/,
/www.seriessub.com/, /www.transcripts.subtitle.me.uk/, /~ Bad Wolf Team/,
/^Transcript by/, /^Update by /, /UKsubtitles.ru/
]
@jnv
jnv / check-urls.sh
Created November 8, 2016 21:08
Bulk check list of URLs with curl; outputs semicolon separated csv
#!/bin/bash
# Usage: check-urls.sh <urls list>
# <urls list> is a text file with 1 URL per line
echo "url;http_code;url_effective;error"
while read -r LINE; do
echo -n "$LINE;"
curl -o /dev/null -sS --max-time 5 --write-out '%{http_code};%{redirect_url};' "$LINE" 2> >(sed -e 's/$/;/' | tr -d '\n' | tr -d '\r')
sync
echo ""
done < "$1"
library(tm)
dirname <- "episodes"
rawCorpus <- Corpus(DirSource(dirname, recursive=TRUE), readerControl=list(language="en"))
my.corpus <- rawCorpus
my.stopwords <- c(stopwords("english"),"ain't","just","can","get","got","will")
my.stopwords <- rev(my.stopwords) # Hack to apply i'll etc. before i
my.stopwords <- my.stopwords[my.stopwords != "who"] # Not a stopword. Not here.
@jnv
jnv / devise.cs.yml
Last active January 13, 2020 12:34 — forked from bver/devise.cs.yml
Czech translation for Devise
#
# Czech translation for Devise - config/locales/devise.cz.yml
# 'cs' locale by https://github.com/bver
# Feel free to correct my translation.
#
# Note: devise.failure.invalid was intentionally changed from "email" to "identity" -
# - not all configurations use config.authentication_keys = [ :email ]
#
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
@jnv
jnv / goout_google_calendar.user.js
Last active November 28, 2018 11:32
Add Event to Google Calendar on GoOut.net #userscript
// ==UserScript==
// @id gooutcalendar@jnv.github.io
// @name GoOut: Add Event to Google Calendar
// @description Displays Calendar button to easily add events to Google Calendar
// @namespace https://jnv.github.io
// @domain goout.net
// @include https://goout.net/*
// @version 2018.11.28
// @grant none
// @run-at document-idle
@jnv
jnv / output.txt
Created October 26, 2018 11:33
BakeryJS Example Output
$ node index.js
dispatch on flow description:
building flow from SchemaObject
* process **********************************************************************
* SERIAL -----------------------------------------------------------------------
* | CONCURRENT -----------------------------------------------------------------
* | - helloworld
* | ----------------------------------------------------------------------------
* | CONCURRENT -----------------------------------------------------------------
* | - wordcount
@jnv
jnv / index.js
Created October 26, 2018 11:06
BakeryJS Example Program
const {Program} = require('bakeryjs');
const program = new Program(
// ServiceProvider
{},
// Program options
{
componentPaths: [`${__dirname}/components/`],
}
);
@jnv
jnv / helloworld.js
Created October 26, 2018 10:50
BakeryJS Example Component (helloworld.js)
const {boxFactory} = require('bakeryjs');
// Just a helper to throttle emitting
const {promisify} = require('util');
const timeout = promisify(setTimeout);
module.exports = boxFactory(
'helloworld',
{