Skip to content

Instantly share code, notes, and snippets.

View msoap's full-sized avatar
🇺🇦

Serhii Mudryk msoap

🇺🇦
  • Kyiv, Ukraine
  • 22:11 (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 / 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 / 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 / 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 / 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 / http-honeypot.go
Last active August 29, 2015 14:11
Honeypot for http tracking
/*
Honeypot for http tracking.
sudo sh -c 'echo "127.0.0.1 google-analytics.com" >> /etc/hosts'
sudo sh -c 'echo "127.0.0.1 googleads.g.doubleclick.net" >> /etc/hosts'
sudo sh -c 'echo "127.0.0.1 mc.yandex.ru" >> /etc/hosts'
go build http-honeypot.go
sudo ./http-honeypot
@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 / 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 / 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 / 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}'