Skip to content

Instantly share code, notes, and snippets.

View yko's full-sized avatar

Yaroslav Korshak yko

  • Plaid
  • Amsterdam, The Netherlands
View GitHub Profile
@yko
yko / manifest.json
Created May 5, 2023 09:25
Extension demo: declarativeNetRequest.URLTransform.queryTransform.addOrReplaceParams
{
"description": "Showcasing declarativeNetRequest.URLTransform.queryTransform.addOrReplaceParams. Try 'https://www.example.com/search?q=test' and 'https://www.google.com/search?q=test'. With the extension installed, the url should receive the additional lr=-lang_en parameter",
"name": "URL Redirect",
"version": "0.1",
"manifest_version": 3,
"declarative_net_request" : {
"rule_resources" : [{
"id": "test_ruleset",
"enabled": true,
"path": "ruleset.json"
@yko
yko / rex.rb
Created December 29, 2016 12:20
Homebrew formula for Rex (naive version): homebrew-core/Formula/rex.rb
class Rex < Formula
desc "Rex is a command line tool which executes commands on remote servers. Define tasks in Perl and execute them on remote servers or groups of servers."
homepage "https://www.rexify.org/"
url "https://cpan.metacpan.org/authors/id/J/JF/JFRIED/Rex-1.4.1.tar.gz"
sha256 "6898add0c9ad8b30b1ea5f70730a53cf899e4fe7228e1f8d5006d6694cfe8eb2"
bottle :unneeded
depends_on 'openssl'
depends_on 'cpanminus'
irc.cable-tv.sumy.ua
irc.chernigov.ua
irc.chokolovka.net
irc.cn.km.ua
irc.d-sto.com
irc.dn.cv.ua
irc.eastnet.com.ua
irc.evpanet.com
irc.feosky.net
irc.gameland.sivash.net
@yko
yko / test.c
Created October 12, 2016 07:21 — forked from caljim/test.c
Simple Ternary Search Tree Implement for C
#include "trident.h"
int main(void)
{
ROOT = create_node(' ',YES);
printf("ROOT addr:%X\n",ROOT);
char* a = "he";
insert_node(a,ROOT);
insert_node("你好",ROOT);
insert_node("中国",ROOT);
@yko
yko / simple-nn-mnist-trained.pl
Created April 17, 2016 15:28
backprop neural net trained by MNIST database
use strict;
use warnings;
use lib 'lib/perl5';
use Fcntl qw(SEEK_SET SEEK_CUR SEEK_END);
use Getopt::Long;
GetOptions( d => \my($DEBUG) );
if (!eval { require AI::NeuralNet::Simple; 1; } || @ARGV != 4 || grep { !-f $_ } @ARGV) {
print <<EOF;
Usage:
@yko
yko / test.sh
Last active August 29, 2015 14:11
http_proxy= curl -X POST -H "content-type: application/json" \
http://localhost:8098/mapred --data @-<<\EOF
{"inputs":[["welcome","german"]]
,"query":[{"map":{"language":"perl","source":"
sub {
my ($m) = lc(shift->{values}[0]{data}) =~ /(\w*)/;
my @r
for my $i (@$m) {
if($i ne '') {
push @r, { $i => 1 };
@yko
yko / main.c
Created December 5, 2014 21:34
#include <string.h>
#include <EXTERN.h>
#include <perl.h>
extern char **environ;
static PerlInterpreter *my_perl;
int main (int argc, char **argv) {
char *embedding[] = { "", "-e", "0" };
PERL_SYS_INIT3(&argc,&argv,&environ);
@yko
yko / srsly.pl
Last active August 29, 2015 14:03
use utf8;
use Carp ();
sub ಠ_ಠ { local $Carp::CarpLevel = 1; &Carp::carp }
ಠ_ಠ "Srsly?";
#!/usr/bin/env perl
use strict;
use warnings;
use File::Spec;
use Pod::Usage;
use Getopt::Long qw(GetOptionsFromArray);
my $basetime = time;
package MyShinyApp;
use Mojo::Base 'Mojolicious';
use DBI;
has dbh => \&_init_dbh;
sub startup { ... }
sub _init_dbh {
my $self = shift;