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 / gist:53bd33b54d022ae536c3a12352fd6ddf
Created November 5, 2020 22:52 — forked from dalethedeveloper/gist:1503252
Mobile Device Detection via User Agent RegEx

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(

/*Transparent pattern placed over an image, like we see on the bootstrap homepage: http://twitter.github.com/bootstrap/index.html*/
div {
width: 200px;
height: 200px;
display: block;
position: relative;
background: url(images/background-image.png);
}
/**
* huffman.c
* Um simples compressor de arquivos usando árvores de Huffman.
* @ver 0.1
* @autores: Fabrício Soares
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
@insinfo
insinfo / IllustratorSaveAsSVGs.jsx
Created April 12, 2021 23:24 — forked from seltzered/IllustratorSaveAsSVGs.jsx
Quick little script to batch-convert Illustrator .ai's to .svg's, based on Adobe's sample 'save to pdf's' script. Save it to a jsx, and load it under illustrator. Intended for Illustrator CS6.
/**********************************************************
ADOBE SYSTEMS INCORPORATED
Copyright 2005-2010 Adobe Systems Incorporated
All Rights Reserved
NOTICE: Adobe permits you to use, modify, and
distribute this file in accordance with the terms
of the Adobe license agreement accompanying it.
If you have received this file from a source
@insinfo
insinfo / main.dart
Created September 21, 2021 22:29 — forked from sangdongvan/main.dart
Dock layout
import 'dart:math';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'dart:ui';
void main() {
runApp(MyHomePage());
}
class MyHomePage extends StatefulWidget {

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

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

Purchase the cert

@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
@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 / 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 / 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-----",