Skip to content

Instantly share code, notes, and snippets.

View insinfo's full-sized avatar

Isaque Neves insinfo

  • Prefeitura de Rio das Ostras
  • Rio de Janeiro - Brasil
View GitHub Profile
@insinfo
insinfo / object-fit-cover-video.js
Created January 22, 2024 22:40 — forked from dmail/object-fit-cover-video.js
object-fit:cover polyfill on video element using canvas
// http://stackoverflow.com/questions/21961839/simulation-background-size-cover-in-canvas
function drawImageProp(ctx, img, x, y, w, h, offsetX, offsetY) {
if (arguments.length === 2) {
x = y = 0;
w = ctx.canvas.width;
h = ctx.canvas.height;
}
// default offset is center
offsetX = typeof offsetX === "number" ? offsetX : 0.5;
@insinfo
insinfo / php_apache_mysql_win10.md
Created December 21, 2023 19:05 — forked from m-antoni/php_apache_mysql_win10.md
How to Setup PHP 7.2, Apache and MySQL in Windows 10

How to Setup PHP 7.2, Apache and MySQL in Windows 10

  1. First is to download php 7 to this website https://windows.php.net/download/

    • download VC15 x86 or x64 Thread Safe
    • download x86 for 32bit and x64 for 64bit system
  2. Make a directory and save it to this path C:/php

  3. Go to https://www.apachelounge.com/download/ to download the Apache server

  • Download Apache 2.4.39 Win64 or Apache 2.4.39 Win32
@insinfo
insinfo / ui_test.dart
Last active November 29, 2023 22:21
ui test in dart with puppeteer
import 'package:new_sali_core/new_sali_core.dart';
import 'package:puppeteer/puppeteer.dart';
import 'package:test/test.dart';
import 'dart:async';
import 'package:path/path.dart' as path;
/// add to pubspec.yaml
// dev_dependencies:
// angel3_hot: any
@insinfo
insinfo / g++ test
Created November 18, 2023 01:00 — forked from 13abylon/g++ test
// g++ test.cpp --std=c++11 -lpthread -O2
//#ifdef WIN32 <- stdafx breaks this ifdef...
//#include "stdafx.h"
//#endif
#include <iostream>
#include <atomic>
#include <thread>
#include <vector>
@insinfo
insinfo / statvfs-df.c
Last active November 29, 2023 23:14 — forked from vgerak/statvfs-df.c
Get disk usage with statvfs()
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/statvfs.h>
#include <sys/types.h>
struct fs_usage {
uintmax_t fsu_blocksize; /* Size of a block. */
uintmax_t fsu_blocks; /* Total blocks. */
uintmax_t fsu_bfree; /* Free blocks available to superuser. */
@insinfo
insinfo / php_substring_html.php
Created August 11, 2023 14:51 — forked from getmanzooronline/php_substring_html.php
PHP Substring without breaking words and HTML tags
<?php
/**
* Truncates text.
*
* Cuts a string to the length of $length and replaces the last characters
* with the ending if the text is longer than length.
*
* @param string $text String to truncate.
* @param integer $length Length of returned string, including ellipsis.
@insinfo
insinfo / rsa_pem.dart
Created June 13, 2023 04:19 — forked from proteye/rsa_pem.dart
How to encode/decode RSA private/public keys to PEM format in Dart with asn1lib and pointycastle
import 'dart:convert';
import 'dart:math';
import 'dart:typed_data';
import "package:pointycastle/export.dart";
import "package:asn1lib/asn1lib.dart";
List<int> decodePEM(String pem) {
var startsWith = [
"-----BEGIN PUBLIC KEY-----",
"-----BEGIN PRIVATE KEY-----",
@insinfo
insinfo / auth.guard.dart
Created October 19, 2022 20:08 — forked from KingDarBoja/auth.guard.dart
AuthGuard example in AngularDart
import 'package:angular_router/angular_router.dart';
import 'package:core/core.dart';
import 'package:web/src/routes.dart';
import 'package:web/src/route_paths.dart';
class AuthGuard implements RouterHook {
Router _router;
AuthenticationState _authBlocState;
set router(Router value) => _router = value;
@insinfo
insinfo / 0. nginx_setup.sh
Created January 27, 2022 20:22 — forked from mikhailov/0. nginx_setup.sh
Nginx + secure pseudo-streaming
# Nginx can serve FLV/MP4 files by pseudo-streaming way without any specific media-server software.
# To do the custom build we use 2 modules: --with-http_secure_link_module --with-http_flv_module
# This module "secure-link" helps you to protect links from stealing away.
#
# NOTE: see more details at coderwall: http://coderwall.com/p/3hksyg
cd /usr/src
wget http://nginx.org/download/nginx-1.5.13.tar.gz
tar xzvf ./nginx-1.5.13.tar.gz && rm -f ./nginx-1.5.13.tar.gz
@insinfo
insinfo / SSL.md
Last active October 9, 2021 16:09 — forked from gangsta/SSL.md
How to Setting Up a Comodo SSL Cert

How to Setting Up a Comodo SSL Cert

  • I advice you to buy SSL Certs from officially Comodo only , or some SSL reseller whose you trust.

These are the steps I went through to set up an SSL cert. Purchase the cert

Prior to purchasing a cert, you need to generate a private key, and a CSR file (Certificate Signing Request). You’ll be asked for the content of the CSR file when ordering the certificate:

openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr