Skip to content

Instantly share code, notes, and snippets.

View vyuh's full-sized avatar

Prashant Karmakar vyuh

View GitHub Profile
@vyuh
vyuh / pk
Created May 8, 2022 12:09
Use of Getopt::Long after reading 'perldoc GetOpt::Long'
#!/usr/bin/env perl
use strict;
use warnings;
use autodie;
use feature qw(say);
use open ':std', ':encoding(UTF-8)';
use Getopt::Long;
use Data::Dumper;
@vyuh
vyuh / Source1.jsx
Created April 13, 2022 21:09
Adobe Premier Pro Transcript Automation
function print_sequences() {
var i = app.project.sequences;
for (var x = 0; x < i.numSequences; x++) {
$.writeln(x + " " + i[x].name);
}
}
function print_activesequence_videotracks() {
var i = app.project.activeSequence.videoTracks;
for (var x = 0; x < i.numTracks; x++) {
$.writeln(x + " " + i[x].name);
@vyuh
vyuh / pk.h
Created October 26, 2021 16:47
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *noram="RAM denied\n";
void die (char *msg) {
fputs (msg, stderr);
exit (0);
}
@vyuh
vyuh / a-tricky-real-sequence.scm
Last active May 14, 2022 11:33
Tried to brute force a tricky real sequence. termux on redmi 4 hangs on (yoo 5). lol
(define (yoo n)
(cond
( (= n 0) (intxdx 0 1))
( ( = n 1) (intxdx (intxdx 0 (/ 1 2)) (intxdx (/ 1 2) 1)))
( else
(let
((N (expt 2 n)))
(intxdx
(calcdown N (/ N 2))
(calcup N (/ N 2)))))))
@vyuh
vyuh / getqueryparameter.elm
Created June 3, 2021 18:13
IGNORE PATH AND GET QUERY PARAMETER
getExam : String -> Maybe String
getExam str = case Url.fromString str of
Nothing -> Nothing
Just u ->
Maybe.withDefault Nothing (Url.Parser.parse (Url.Parser.query (Url.Parser.Query.string "exam")) { u | path = "" })
extractSearchArgument : String -> Url -> Maybe String
extractSearchArgument key location =
{ location | path = "" }
|> Url.Parser.parse (Url.Parser.query (Url.Parser.Query.string key))
@vyuh
vyuh / emmet_tokens.txt
Created July 21, 2020 18:00
EMMET LEXER TOKENS
APPEND '+'
ASC '@'
DESC '@-'
ASCEND '^'
ATTR [a-zA-Z_:][-_:.a-zA-Z0-9]*
ATTREND ']'
ATTRSTART '['
CLASS [-a-zA-Z0-9]\+
DESCEND '>'
DOLLAR '$'
@vyuh
vyuh / question.txt
Created July 6, 2020 16:01
QUESTION ON STATS.PL
NUMBERS as JSON formatted strings may be very big ->
JSON::PP allow_bignum decode ->
List::Util sum0. &stats ->
JSON::PP allow_bignum encode ->
NUMBERS ENCODED AS STRINGS. WRONG CALCULATED VALUES DUE TO OVERFLOWS.
I can tolerate imprecise calculation of mean and variance,
but not entirely inaccurate result or numerical result encoded as string.:w
I am using a function to calculate statistics for a list of numbers.
These numbers may be big enough to lose precision if stored as normal perl numbers.
@vyuh
vyuh / dec_enc_json_custom.elm
Created June 22, 2020 13:10
ELM: Encoding Custom Types to JSON. Decoding Custom Types from JSON.
type Custom = Custom String
type alias P = { i : Int, s: String, c: Custom }
p = P 4 "mo" (Custom "jo")
import Json.Encode as E
import Json.Decode as D
enc : P -> E.Value
@vyuh
vyuh / export_data_from_j.md
Last active May 26, 2020 20:21
Exporting data to file from jconsole

exporting data from [jconsole][j installation zip].

rlo =. 4 : 'a; (,.b); +/@:*: (b =. ? 0 $~ # y)+ y - (a =. ? 0 $~ #@> y;x) +/ . * x'
iter =. 3 : 'y; 1 2 3 rlo 5 7 8 9'
data =: iter"0 i.50
outstr =: ": data
require 'files'
outstr fwrite 'out.txt'
(": $ outstr) fappend 'out.txt'
@vyuh
vyuh / data-walk-email-bug-report.txt
Last active May 14, 2018 17:25
Data::Walk Bug Report and Patch
Subject: Top Level Object should not have a container
Data::Walk Version 2.01 assigns `container` and `type` for top-level objects
in an inconsistent way. On one hand, A scalar at top level gets the
arrayref of `@args` as `container`, and `ARRAY` as `type`. Whereas
a hashref, or arrayref, at top-level gets *ITSELF* as the `container`,
and its own ref type (`ARRAY|HASH`) as `type`. The latter behaviour
is not consistent because it implies that the item is contained in
itself.