Skip to content

Instantly share code, notes, and snippets.

View AlekPet's full-sized avatar

Aleksey Petrov (AlekPet) AlekPet

View GitHub Profile
function hex(r,g,b){
var hexv="0123456789ABCDEF";
var valhex="";
var ff=[r,g,b];
for(var i=0;i<3;i++){
var del= ff[i] % 16;
var di=Math.floor(ff[i]/16);
if(ff[i]>=255){
valhex+="FF";
} else if(ff[i]<=0){
@AlekPet
AlekPet / TestCollections.cs
Last active November 18, 2017 13:20
Collection C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace TestCollections
{
public class Person
{
// https://www.w3schools.com/colors/colors_names.asp
var t ="",
el=document.querySelectorAll(".w3-table-all tr td:nth-child(1) a");
for (var i = 0; i < el.length; i++) {
if(!(i%10)) t+="\n";
t += '"'+el[i].innerText.toLowerCase()+'", ';
}
console.log(t);
@AlekPet
AlekPet / Rainbow - Text between two colors.php
Created September 20, 2018 10:28
Rainbow - Text between two colors
<!doctype html>
<html>
<body>
<?php
function rainbow($str){
$phase = 0;
$center = 128;
$width = 128;
$s="";
$frequency = M_PI*2/strlen($str);
def digits(L, di = 3):
print("Цифры меньше или равно ", di)
return sorted({nums for num in L.values() for nums in num if nums <= di})
mnosh = {
"one":{1,3.2,3.02,2.78,1.999,2,99998,3,4,5,43},
"two":{6,0.7,8,9,0.10,.1,4,2,0.2,0.003,3},
"three":{0.4,0.005,4.3,234.5,1,2.01},
}
@AlekPet
AlekPet / Auto_Cheats_Input_America_Game.mac
Last active February 2, 2019 10:59
Auto input cheats codes in game America - No Peace Beyond The Line (Завоевание Америки)
// **************************
// Game: America - No Peace Beyond The Line (Завоевание Америки)
// Author: AlekPet 2019
// Site: https://github.com/AlekPet
// Program run script: AC Tool 5.4.0
// Descriptions: Auto input cheats codes in game
// Instructions: Run game, run script and back to the game (wait 5 sec *default set delay_start**)
// **************************
Constants
@AlekPet
AlekPet / FindNotExistsFiles.py
Created May 4, 2019 21:08
Find not exists files in dir and subdir, if search copy to files... Resore not exists files in dir...
# -*- coding: utf-8 -*-
# Author: AlekPet
# Name: Find files in dir and subdir
import os
import shutil
# Path to copy find files to
pathSave = r'C:\Users\UserName\Desktop\FindNotExistFiles\'
# Where search files
@AlekPet
AlekPet / replaceUpperCasePlusOnSpace.py
Created July 16, 2023 19:21
Replace example: TranslateCLIPEncodeText to Translate CLIP Encode Text
### by AlekPet 2023
### Replace UpperCase to UpperCase and space
import re
def getUpdateString(text):
return re.sub('(?<=[a-z])([A-Z])|(?<=[A-Z])([A-Z][a-z]+)',' \\1\\2', text)
test_string = 'HeloItIsBigWorldGetYouHELLOPeople'
output = getUpdateString(test_string)