Skip to content

Instantly share code, notes, and snippets.

View thinmy's full-sized avatar
🎯
Focusing

Thinmy Patrick Alves thinmy

🎯
Focusing
View GitHub Profile
@thinmy
thinmy / deskew.py
Created November 11, 2024 00:10 — forked from zabir-nabil/deskew.py
compute skew angle and deskew in python (opencv)
import numpy as np
import math
import cv2
def rotate_image(image, angle):
image_center = tuple(np.array(image.shape[1::-1]) / 2)
rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
result = cv2.warpAffine(image, rot_mat, image.shape[1::-1], flags=cv2.INTER_LINEAR)
return result
@eusonlito
eusonlito / all.sh
Created February 27, 2023 14:31
PHP 8.2 extension
apt install php8.2 php8.2-amqp php8.2-apcu php8.2-ast php8.2-bcmath php8.2-bz2 php8.2-cgi php8.2-cli php8.2-common php8.2-curl php8.2-dba php8.2-decimal php8.2-dev php8.2-ds php8.2-enchant php8.2-excimer php8.2-fpm php8.2-gd php8.2-gmp php8.2-gnupg php8.2-grpc php8.2-http php8.2-igbinary php8.2-imagick php8.2-imap php8.2-inotify php8.2-interbase php8.2-intl php8.2-ldap php8.2-libvirt-php php8.2-lz4 php8.2-mailparse php8.2-maxminddb php8.2-mbstring php8.2-memcache php8.2-memcached php8.2-mongodb php8.2-msgpack php8.2-mysql php8.2-oauth php8.2-odbc php8.2-opcache php8.2-pcov php8.2-pgsql php8.2-phpdbg php8.2-pinba php8.2-protobuf php8.2-ps php8.2-pspell php8.2-psr php8.2-raphf php8.2-rdkafka php8.2-readline php8.2-redis php8.2-rrd php8.2-smbclient php8.2-snmp php8.2-soap php8.2-sqlite3 php8.2-ssh2 php8.2-stomp php8.2-swoole php8.2-sybase php8.2-tideways php8.2-tidy php8.2-uopz php8.2-uuid php8.2-vips php8.2-xdebug php8.2-xhprof php8.2-xml php8.2-xmlrpc php8.2-xsl php8.2-yaml php8.2-zip php8.2-zmq php8.2-zstd
@BretFisher
BretFisher / Dockerfile
Last active March 24, 2025 19:31
Multi-stage Dockerfile example of installing dependencies with COPY --from
# any images you use later, add them here first to create aliases
# I like keeping all my versions at the top
FROM node:14.3-slim as node
FROM php:7.2.1-fpm-slim as php
FROM nginx:1.17 as nginx
# The real base image to start from
FROM ubuntu:focal-20210827 as base
# install apt stuff
@num8er
num8er / polyfills.php
Last active December 4, 2024 20:51
PHP 5.3 to 7.x migration polyfill collection.
<?php
namespace Polyfills
{
final class Ereg
{
public static function ereg($pattern, $string, &$regs = null)
{
if ($pattern === '' || $pattern === null) {
trigger_error('ereg(): REG_EMPTY', E_USER_WARNING);
@JakubOboza
JakubOboza / private-docker-regs-with-free-tiers.markdown
Created May 30, 2019 07:15
Private Docker registry with free tiers for Developers.

List of sites with free tier limits

  • Docker Hub - One private repo/image spot for free
  • Three Scale - Very generous free tier 50GB of space, 500 Pulls a month etc..
  • Canister - 20 private repos with almost no limits on free tier
  • Code Fresh - Free tier for developers

Setup your own private registry

@hakib
hakib / admin.py
Last active January 22, 2024 15:18
How to Turn Django Admin Into a Lightweight Dashboard
# https://hakibenita.com/how-to-turn-django-admin-into-a-lightweight-dashboard
from django.contrib import admin
from django.db.models import Count, Sum, Min, Max, DateTimeField
from django.db.models.functions import Trunc
from . import models
def get_next_in_date_hierarchy(request, date_hierarchy):
@gmolveau
gmolveau / uuid_user.py
Last active January 17, 2025 02:56
sqlalchemy uuid for sqlite
########################
# UUID for SQLite hack #
########################
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUID
import uuid
class GUID(TypeDecorator):
@thekoushik
thekoushik / aws_ec2_php56_mysql56.md
Last active January 10, 2025 15:19
AWS EC2 Instance PHP 5.6 and MySQL 5.6

PHP

centos

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum remove php-common
yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
/etc/init.d/httpd restart
@slightfoot
slightfoot / page_storage_example.dart
Created April 17, 2018 20:32
Flutter PageStorage Example. Counter displayed will always be the same as the page index. Note: PageStorageKey parameter must be unique within the Route.
import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Page Test',
@jmosul
jmosul / SimpleVueServiceProvider.js
Last active September 26, 2023 01:04
A simple (singleton) service provider for VueJS
class ServiceProvider {
constructor(services) {
this._services = services;
// use proxy to create a "magic getter" that will search the _services for a matching name
// then call "_makeOnce" to instantiate or return the singleton
return new Proxy(this, {
get: (provider, service) => {
service = service.charAt(0).toUpperCase() + service.slice(1);