Skip to content

Instantly share code, notes, and snippets.

View morontt's full-sized avatar
🤖
Just for Fun

Alexander Harchenko morontt

🤖
Just for Fun
View GitHub Profile
@morontt
morontt / excel.php
Created June 24, 2022 13:27
Excel letter columns to number
<?php
function number($str) {
$arr = str_split($str);
$sum = 0;
for ($i = count($arr) - 1; $i >= 0; $i--) {
$idx = ord(strtoupper($arr[$i])) - 64;
$sum += $idx * (26 ** (count($arr) - $i - 1));
}
ip_addresses_*.txt
<?php
/**
* Результат:
* Тестовый текст с тегом 1,
* Итак, счётчик 2, 3 - 4
* И ещё 5
* 6
*/
$text = <<<TEXT
ffmpeg -i input.mp4 -vf scale=1280:-1 -c:v libx264 -preset slow -c:a copy output.mp4
@morontt
morontt / chicken.go
Last active May 16, 2019 16:09
Chicken problem
package main
// About chickens
// https://habr.com/ru/post/348066
import (
crand "crypto/rand"
"fmt"
"math"
"math/rand"
#!/bin/sh
echo "Test CS-fixer"
echo ""
docker exec container_name sudo -u www-data /var/www/html/vendor/bin/php-cs-fixer fix --dry-run
if [ $? -gt 0 ]
then
echo ""
echo "Found ugly code, not pushing"
@morontt
morontt / .gitignore
Last active December 4, 2018 10:41
log parser
We couldn’t find that file to show.
@morontt
morontt / load-graph.ipynb
Created November 21, 2017 17:03
peak loads
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@morontt
morontt / Dockerfile
Created November 21, 2017 09:35
angular dockerfile
FROM node:6-wheezy
RUN npm install -g gulp-cli && npm install -g @angular/cli
RUN mkdir /ng-app
VOLUME ["/ng-app"]
WORKDIR "/ng-app"
EXPOSE 4200
@morontt
morontt / rsa_sign.py
Created May 30, 2017 08:24
RSA signature
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import ConfigParser
from Crypto.Hash import SHA
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from base64 import b64encode
config = ConfigParser.ConfigParser()