Skip to content

Instantly share code, notes, and snippets.

View lov3catch's full-sized avatar
☺️
🐍 Python / 🐘 PHP / 🚀 Racket

ihor.kpl lov3catch

☺️
🐍 Python / 🐘 PHP / 🚀 Racket
View GitHub Profile
@lov3catch
lov3catch / array_group.php
Created January 25, 2023 14:10
Group array by key
<?php
declare(strict_types=1);
$items = [
["id" => 20, "name" => "chimpanzee"],
["id" => 40, "name" => "meeting"],
["id" => 20, "name" => "dynasty"],
["id" => 50, "name" => "chocolate"],
["id" => 10, "name" => "bananas"],
@lov3catch
lov3catch / unique.php
Created November 7, 2022 12:54
Unique array by multiple fields
<?php
declare(strict_types=1);
$input = [
['name' => 'toto', 'type' => '1', 'type2' => '2'],
['name' => 'tata', 'type' => '1', 'type2' => '3'],
['name' => 'titi', 'type' => '1', 'type2' => '2'],
['name' => 'tutu', 'type' => '2', 'type2' => '4'],
['name' => 'tete', 'type' => '3', 'type2' => '2'],
@lov3catch
lov3catch / run.rkt
Last active August 15, 2022 14:13
Display random quote from bash.org
#lang racket/base
(require net/http-easy
html-parsing
racket/port
sxml/sxpath
racket/string
net/url)
;; Set variables
@lov3catch
lov3catch / run.rkt
Created August 13, 2022 14:27
Racket (Parse html)
#lang racket/base
(require html-parsing
net/url
sxml/sxpath)
(define bashorg (html->xexp
(get-pure-port (string->url "http://bashorg.org"))))
((sxpath "//*[@id='quotes']/div[1]/div[2]") bashorg)
@lov3catch
lov3catch / .hyper.js
Created October 28, 2019 09:12 — forked from silverjerk/.hyper.js
Hyper Config File
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
https://github.com/beberlei/assert
Список мастхев либ и возможно какие-то мысли.
https://github.com/bocharsky-bw/Arrayzy
https://github.com/php-ds/ext-ds
import base64
from PIL import Image
def img_2_base64(img_path):
"""
Convert img to base64
"""
from __future__ import unicode_literals
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'ws_db',
'USER': '',
@lov3catch
lov3catch / server_controlls
Last active August 29, 2015 14:26
Example of making controller for server (start/stop)
class Statuses(object):
ON = 1
OFF = 2
class Singleton(type):
_instance = None
def __call__(cls, *args, **kwargs):
data = [2, 3]
# actions
def aaa(data):
return [i+'_aaa' for i in data()]
def bbb(data):
return [i+'_bbb' for i in data()]
# templates