Skip to content

Instantly share code, notes, and snippets.

View msoap's full-sized avatar
🇺🇦

Serhii Mudryk msoap

🇺🇦
  • Kyiv, Ukraine
  • 18:23 (UTC +03:00)
View GitHub Profile
package main
import "fmt"
func main() { fmt.Println(q + "\x60" + q + "\x60") }
var q = `package main
import "fmt"
@msoap
msoap / script.go
Last active October 8, 2022 17:23
Run Go program as script
//usr/bin/env go run $0 "$@"; exit
package main
import (
"fmt"
"os"
)
func main() {
fmt.Println("Hello world!")
@msoap
msoap / generics_handlers.go
Created July 22, 2021 14:59
Handling handlers with different types via Go generics (using go 1.18+)
package main
import (
"encoding/json"
"fmt"
)
func main() {
app := NewApp()
server := NewServer()
@msoap
msoap / wgethtml.pl
Last active June 9, 2020 09:46
save html page with css/js/images
#!/usr/bin/perl
#################################################
#
# load html with css/js/img and embed it
#
#################################################
use warnings;
use strict;
@msoap
msoap / safari-get-all-tabs-urls.sh
Last active May 19, 2020 07:45
get Safari all tabs urls and titles
#!/bin/sh
osascript<<APPLESCRIPT 2>&1
-- get Safari all tabs urls and titles
-- safari-get-all-tabs-urls.sh | less
tell application "Safari"
set tabsList to front window's tabs as list
repeat with currTab in tabsList
set currName to currTab's name
set currURL to currTab's URL
@msoap
msoap / http-mojo-server-test.pl
Created March 16, 2012 20:11
test http server for static files via Mojo::Server::Daemon
#!/usr/bin/perl
=head1 NAME
http-mojo-server-test.pl
=head1 DESCRIPTION
test http server via Mojo::Server::Daemon
@msoap
msoap / Raspberry Pi httpd benchmark.md
Last active September 26, 2018 16:09
Raspberry Pi httpd benchmark with wrk

Raspberry Pi httpd benchmark

Total RPS

All:

               Go/fasthttp (10 thr): 930.0 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

Nginx (10 thr): 826.1 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

@msoap
msoap / golang-quality-check.sh
Created September 13, 2018 12:05
Quick and easy golang project quality check
find . -name '*.go' | xargs grep -r 'interface{}' | wc -l
@msoap
msoap / Go vs Perl memory usage.md
Last active April 11, 2018 07:13
Go vs Perl memory usage

Go vs Perl memory usage

{int}->{int} = int:
  lang (keys² q-ty): MB of memory
  Go   (1500²):   66.38 ■■■■■■■■■■■■■■■■■■■■■■■■■■
  Perl (1500²):  131.46 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

  Go   (1000²):    40.8 ■■■■■■■■■■■■■■■■

Perl (1000²): 57.65 ■■■■■■■■■■■■■■■■■■■■■■■

@msoap
msoap / E.pm
Created March 26, 2012 20:46
E.pm - module for perl oneliners
package E;
=head1 DESCRIPTION
module for perl oneliners
=head1 SYNOPSIS
perl -ME -e 'p [map {"$_$_"} qw/q w e/]'
perl -ME -e 'j {%ENV}'