Skip to content

Instantly share code, notes, and snippets.

View necenzurat's full-sized avatar
🥺
I still hate JS

Costin Moise necenzurat

🥺
I still hate JS
View GitHub Profile
@zabaala
zabaala / BindDatabaseServiceProvider.php
Last active March 2, 2021 07:50
php artisan db:log <start> <stop>
<?php
namespace App\Commands\Database;
use Illuminate\Support\ServiceProvider;
class BindDatabaseServiceProvider extends ServiceProvider
{
public function boot()
{
@e7d
e7d / README.md
Last active March 23, 2022 22:40
[Debian] Setup a Squid anonymous proxy
@hmoenck
hmoenck / slackpost.sh
Last active January 8, 2019 21:28
Slackpost
#!/bin/bash
# Usage: slackpost <channel> <message>
# Setup:
# 1. Create an incoming webhook. Link can be found in https://api.slack.com/custom-integrations
# 2. Retrieve link like https://hooks.slack.com/services/T0XXXXXXX/BXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX
# 3. Add link to this script (webhook)
# 4. Add your slackhost
# 5. Profit
@webarthur
webarthur / gist:0ed27fbf811bbcc94e7c7c476b5d8f91
Created May 17, 2016 05:25
Force Apt-Get to IPv4 or IPv6 on Ubuntu or Debian
sudo echo "Acquire::ForceIPv4 \"true\";" > /etc/apt/apt.conf.d/99force-ipv4
@dannguyen
dannguyen / README.md
Last active May 17, 2024 02:07
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs

@amberovsky
amberovsky / slack.sh
Created March 13, 2016 10:45
Slack incoming webhooks from bash (send notification to slack from shell)
read -d '' SLACK_PAYLOAD_DATA << EOF
{
"channel": "#channel",
"username": "Bot",
"text": "Message by _$(id -un)@$(hostname -f)_.",
"icon_emoji": ":poop:",
"attachments": [
{
"fields": [
{
@Tmeister
Tmeister / nginx.conf
Last active November 11, 2019 16:13
Laravel Server Setup
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/laravel/public;
index index.php index.html index.htm;
server_name localhost;
location ~ \.php$ {
@cfenollosa
cfenollosa / email-deadlines.php
Last active April 24, 2018 18:17
Postpone your own email
#!/usr/bin/env php
<?php
// Script to postpone your own email. Parses IMAP folders and moves emails to a folder named "Today"
// Run this from a crontab, for example at 6 AM
// BSD License
// (C) Carlos Fenollosa, 2011-2016
// Read more about this script: http://cfenollosa.com/blog/a-simple-script-to-postpone-your-own-email.html
// Please leave comments and feedback for bugs and ideas!
@rap2hpoutre
rap2hpoutre / laravel-forge-deploy.sh
Last active March 28, 2024 15:45
Laravel Forge deploy script without downtime
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/deploy" ]; then
rm -R /home/forge/deploy
fi
if [ -d "/home/forge/backup" ]; then
rm -R /home/forge/backup
fi
@phanan
phanan / runner.js
Last active May 8, 2024 08:44
Record a webpage with PhantomJS and FFMpeg
// Run this from the commandline:
// phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 24 -t 10 -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart output.mp4
var page = require('webpage').create(),
address = 'http://s.codepen.io/phanan/fullembedgrid/YPLewm?type=embed&safe=true&_t=1424767252279',
duration = 3, // duration of the video, in seconds
framerate = 24, // number of frames per second. 24 is a good value.
counter = 0,
width = 500,
height = 500;