Skip to content

Instantly share code, notes, and snippets.

View romanitalian's full-sized avatar
🎯
Focusing

roman romadin romanitalian

🎯
Focusing
View GitHub Profile
@romanitalian
romanitalian / bubble.php
Created May 12, 2020 16:28 — forked from PedroEscudero/bubble.php
Bubble script for testing speed of PHP-8
<?php
function bubble_sort($array)
{
$start = microtime(true);
do
{
$sw = false;
for($i = 0, $size = count($array) - 1; $i < $size; $i++)
{
if( $array[$i] > $array[$i + 1] )
@romanitalian
romanitalian / how_fast_php8.sh
Created May 12, 2020 16:35
How fast is PHP-8 going to be?
#!/bin/bash
# How fast is PHP-8 going to be?
# https://levelup.gitconnected.com/how-fast-is-php-8-going-to-be-f7fdc111cd6
mkdir ~/wks/src/roman.dev/how_fast_php8
cd ~/wks/src/roman.dev/how_fast_php8
wget https://gist.githubusercontent.com/romanitalian/c39b7e3182c82f518f0bd74e531f39d1/raw/3e8235f998aaf9f19b671fda75de80393756e33e/bubble.php
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'}
" color schema
Plug 'morhetz/gruvbox'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'jiangmiao/auto-pairs'
Plug 'airblade/vim-gitgutter'
@romanitalian
romanitalian / deploy_by_git_hooks.sh
Created September 28, 2020 09:18
Deploy Project to remote host by Git Hooks
#!/bin/sh
# USAGE "local" (change manualy value in <USER>, <SERVER_HOST>, <SERVER_PORT> and <REPO_DIR>):
#
# cd ~/wks/src/github.com/<USER>/project
# git remote add prod ssh://root@<SERVER_HOST>:<SERVER_PORT><REPO_DIR>
# CONFIG
package main
import (
"math/rand"
"testing"
"time"
)
// slice_and_heap_allocation_test.go
package main
import (
"testing"
)
type box struct {
data *byte
}
func faviconHandler(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "relative/path/to/favicon.ico")
}
...
func main() {
http.HandleFunc("/favicon.ico", faviconHandler)
}
import (
"bytes"
"image"
"image/gif"
"net/http"
...
)
var buf bytes.Buffer
gif.Encode(&buf, image.Rect(0, 0, 16, 16), nil)
import (
"bytes"
"image"
"image/color"
"image/draw"
"image/jpeg"
...
)
buf := new(bytes.Buffer)
var buf bytes.Buffer
gif.Encode(&buf, image.Rect(0, 0, 1, 1), nil)