Skip to content

Instantly share code, notes, and snippets.

View fagci's full-sized avatar
👁️
What's happening?

Mikhail fagci

👁️
What's happening?
View GitHub Profile
@fagci
fagci / copy_dir_as_zip_to_remote.sh
Created May 14, 2019 12:14
Zip directory and copy it to remote server without creating file on local machine.
#!/usr/bin/env bash
FROM_DIRECTORY=$1
SERVER=$2
TO_ARCHIVE=$3
zip -r - $FROM_DIRECTORY | ssh $SERVER "cat > $TO_ARCHIVE"
@fagci
fagci / system-fonts.scss
Last active August 12, 2019 05:46
Most recent variant of CSS system font families
$font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
$font-family-sans-serif-condensed: "DINNextW01-CondensedMed", "AvenirNextCondensed-Bold", "Futura-CondensedExtraBold", HelveticaNeue-CondensedBold, "Ubuntu Condensed", "Liberation Sans Narrow", "Franklin Gothic Demi Cond", "Arial Narrow", "Roboto Condensed", sans-serif-condensed, Arial, "Trebuchet MS", "Lucida Grande", Tahoma, sans-serif;
$font-family-serif: Georgia, Times, Times New Roman, serif;
$font-family-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
.condensed {
font-family: $font-family-sans-serif-condensed;
font-stretch: condensed;
}
@fagci
fagci / render_string_path_template_using_nested_array.php
Last active July 2, 2020 07:59
PHP function to render string path template using nested array
<?php
/**
* PHP function to render string path template using nested array.
* Renders template string like "Nested array item value: {data.some.nested.item.value}"
* @param string $template
* @param array $data
* @return string
*/
public static function renderDataTemplate(string $template, array $data): string
@fagci
fagci / UnescapedJsonMiddleware.php
Last active March 4, 2020 08:43
Laravel / Lumen json options for response using middleware. Used for returning unescaped utf-8 unicode response.
<?php
namespace App\Http\Middleware;
use Closure;
class UnescapedJsonMiddleware
{
public function handle($request, Closure $next)
{
@fagci
fagci / active-links.min.js
Last active April 3, 2020 18:04
Vanilla JavaScript highlight current link by active class
@fagci
fagci / index.html
Last active January 23, 2021 13:12
HTML5 template with mobile devices support
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Title</title>
</head>
<body>
<h1>Heading</h1>
</body>
@fagci
fagci / http_sniffer.py
Created October 8, 2020 18:16
Simple python HTTP sniffer
#!/usr/bin/python
import socket
HOST = socket.gethostbyname(socket.gethostname())
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)
s.bind((HOST,0))
while True:
@fagci
fagci / README.md
Last active January 28, 2021 09:49
Responsive tables with grid (sass)

Desktop:

Name Age Sex Comment

Mobile:

@fagci
fagci / fortune.py
Created February 5, 2021 21:04
My fastest python native implementation of IP http fortune
#!/usr/bin/env -S python -u
"""My fastest python native implementation of IP http fortune"""
import socket as so
from threading import Lock, Thread
from random import randrange
from time import sleep
import re
__author__ = 'Mikhail Yudin aka fagci'
@fagci
fagci / truncate.sh
Last active April 3, 2021 13:07
Truncate git history to last state on remote repository (alternative variant)
#!/usr/bin/env sh
# backup repo config
cp .git/config /tmp/truncate.git.config
# cleanup history
rm -rf .git
git init
# restore repo config