Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kovetskiy's full-sized avatar
🏊

Egor Kovetskiy kovetskiy

🏊
View GitHub Profile
#!/bin/bash
set -euo pipefail
table="${1:-}"
view="${2:-}"
if [[ -z "$table" || -z "$view" ]]; then
echo "Usage: $0 <table> <view>"
exit 1
#!/bin/python
# vim: ft=python
import fileinput
import sys
pods = open(sys.argv[1], 'r').readlines()
cluster_nodes = open(sys.argv[2], 'r').readlines()
@kovetskiy
kovetskiy / main.go
Created November 18, 2020 18:34
Go get stacktrace
func getStack(skip int) string {
buffer := make([]byte, 1024)
for {
written := runtime.Stack(buffer, false)
if written < len(buffer) {
// call stack contains of goroutine number and set of calls
// goroutine NN [running]:
// github.com/user/project.(*Type).MethodFoo()
// path/to/src.go:line
// github.com/user/project.MethodBar()
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@kovetskiy
kovetskiy / main.js
Created June 4, 2020 13:28 — forked from kdzwinel/main.js
List all undefined CSS classes
/*
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets.
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there).
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ .
Known limitations:
- it won't be able to take into account some external stylesheets (if CORS isn't set up)
- it will produce false negatives for classes that are mentioned in the comments.
0 is not stdin on windows
#7 started for future.
ability to kill sudo background process
a bit of refactoring, minor improvements
A breath of fresh air
accept arbitrary size tokens
accept arbitrary types as nested error
Account for DataCenter mode while looking for hook scripts
Activity reviewing is now avaiable
actually, clear status on exit
package hookstest
import (
"fmt"
)
func ShouldNotPass() {
fmt.Printf(
"This code should not pass linting because it has broken message formatting: %s\n",
)
package hookstest
import (
"fmt"
)
// ShouldPass prints a message that this function passes any code linter
func ShouldPass() {
fmt.Println("This code should pass any linter")
}
var apm = require('elastic-apm-node').start()
var http = require('http')
var process = require('process')
function sleep(time) {
var stop = new Date().getTime();
while(new Date().getTime() < stop + time) {
;
}
}
sudo systemctl stop kafka; sudo rm -rf /var/lib/kafka/my-topic-0; sudo systemctl start kafka; AMOUNT=20000 THREADS=5 CYCLES=10 go run main.go
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused
2018/07/18 15:02:47 dial tcp [::1]:9092: connect: connection refused