Skip to content

Instantly share code, notes, and snippets.

View denisvmedia's full-sized avatar
🚀
Flying to Mars

Denis Voytyuk denisvmedia

🚀
Flying to Mars
View GitHub Profile
@denisvmedia
denisvmedia / quit-by-closing-channel.go
Created June 15, 2017 09:01
Quit by closing channel
package main
import "sync"
import "fmt"
import "time"
func main() {
quit := make(chan interface{}, 10)
wg := sync.WaitGroup{}
wg.Add(1)
@denisvmedia
denisvmedia / site-speed.sh
Last active June 12, 2018 18:42
measure site speed
curl -Lo /dev/null -skw \
"\ntime_connect: \
%{time_connect}s\ntime_namelookup: \
%{time_namelookup}s\ntime_pretransfer: \
%{time_pretransfer}\ntime_starttransfer: \
%{time_starttransfer}s\ntime_redirect: \
%{time_redirect}s\ntime_total: \
%{time_total}s\n\n" \
http://foolproofcode.com
@denisvmedia
denisvmedia / delete_git_submodule.md
Created July 19, 2018 19:53 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@denisvmedia
denisvmedia / jpg-date-fixer.go
Created April 14, 2019 07:22
JPG file time fixer using exif data
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
@denisvmedia
denisvmedia / Linear Regression.md
Last active May 19, 2023 11:54
Predicting the Missing Humidity Values

Predicting the Missing Humidity Values

part1 part2 part3 part4

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.

Prerequisites

This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).

@denisvmedia
denisvmedia / math.go
Last active December 6, 2021 09:06
Go unit test example: _test package suffix + multiple test cases
package math
import "errors"
var ErrCantDivideByZero = errors.New("can't divide by zero")
// divide cannot be tested directly
func divide(x, y float32) float32 {
return x / y
}
@denisvmedia
denisvmedia / cheatsheet.md
Last active August 8, 2023 16:44
midjourney cheat sheet

Commands

/imagine

/show

/info

/fast