Skip to content

Instantly share code, notes, and snippets.

View ArtMares's full-sized avatar

Dmitriy Dergachev ArtMares

View GitHub Profile
@ArtMares
ArtMares / graceful.go
Created February 13, 2020 08:41 — forked from peterhellberg/graceful.go
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
@ArtMares
ArtMares / color_luminance.php
Created February 13, 2020 08:31 — forked from stephenharris/color_luminance.php
Lighten or darken a given colour
<?php
/**
* Lightens/darkens a given colour (hex format), returning the altered colour in hex format.7
* @param str $hex Colour as hexadecimal (with or without hash);
* @percent float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() )
* @return str Lightened/Darkend colour as hexadecimal (with hash);
*/
function color_luminance( $hex, $percent ) {
// validate hex string
@ArtMares
ArtMares / save.py
Created February 13, 2020 08:20 — forked from mickael9/save.py
Factorio map metadata parser
from zipfile import ZipFile
from struct import Struct
class Deserializer:
u16 = Struct('<H')
u32 = Struct('<I')
def __init__(self, stream):
self.stream = stream
@ArtMares
ArtMares / index.html
Created February 13, 2020 08:18 — forked from shiawuen/index.html
Sample to upload file by chunk
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>test upload by chunk</title>
</head>
<body>
<input type="file" id="f" />
<script src="script.js"></script>