Skip to content

Instantly share code, notes, and snippets.

View netinhoteixeira's full-sized avatar

Francisco Ernesto Teixeira netinhoteixeira

View GitHub Profile
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@letanure
letanure / estados-cidades.json
Last active November 19, 2024 20:06
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@r-martins
r-martins / ubuntu.txt
Created October 3, 2012 22:33
Resolvendo problema de Ç (cedilha) No Ubuntu
Alguns programas (que usam GTK) no Ubuntu nao funcionam a Ç cedilha com ' + c.
Pra resolver:
Problem with cedilla:
After many versions of Ubuntu assigning accented c (“ć”) instead of c with a cedilla (“ç”) when typing ‘ + c in deadkeys keyboard layouts, since Ubuntu 11.10 GTK changed the default in an U.S. English locale back to the cedilla. However, non-GTK applications (e.g., Skype) still have the old behavior. To fix them, edit as root the file /usr/share/X11/locale/en_US.UTF-8/Compose and change all instances of ć with ç, and all instances of Ć with Ç.
You might need to repeat this operation from time to time, when you upgrade your system and it takes the configuration files back to their original contents.
@ranacseruet
ranacseruet / VideoStream.php
Last active October 30, 2024 12:43
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@alessandroleite
alessandroleite / cert.java
Last active March 2, 2024 00:41
Generate a self signed X509 certificate with Bouncy Castle
//Generate a self signed X509 certificate with Bouncy Castle.
// StringBuilder sb = new StringBuilder();
//
// for (int i = 0; i < pub.length; ++i)
// {
// sb.append(Integer.toHexString(0x0100 + (pub[i] & 0x00FF)).substring(1));
// }
//
// System.out.println(sb);
// sb.setLength(0);
@slashfan
slashfan / ImageExtractor.php
Created March 11, 2015 08:40
Basic ImageExtractor PHP Class - Extract first page of a PDF file to an image (jpg or png) using Imagick PHP extension
<?php
namespace Acme\Util;
/**
* ImageExtractor
*/
class ImageExtractor
{
const FORMAT_JPG = 'jpg';
@chrisvoo
chrisvoo / fluent.java
Last active September 23, 2016 00:48
GET/POST HTTP JSON request with Apache Fluent library (libphonenumber Google library)
/**
* Apache HTTP Fluent client configuration
* @throws KeyStoreException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws IOException
* @throws CertificateException
*/
public static void httpClientConfigurator() throws KeyStoreException, KeyManagementException, NoSuchAlgorithmException,
CertificateException, IOException {
@funzoneq
funzoneq / simplehttp.service
Created May 25, 2016 13:24
A systemd file for a python SimpleHTTPServer
[Unit]
Description=Job that runs the python SimpleHTTPServer daemon
Documentation=man:SimpleHTTPServer(1)
[Service]
Type=simple
WorkingDirectory=/tmp/letsencrypt
ExecStart=/usr/bin/python -m SimpleHTTPServer 80 &
ExecStop=/bin/kill `/bin/ps aux | /bin/grep SimpleHTTPServer | /bin/grep -v grep | /usr/bin/awk '{ print $2 }'`
@vivekkr12
vivekkr12 / BouncyCastleCertificateGenerator.java
Last active October 10, 2024 10:13
Generate root X509Certificate, Sign a Certificate from the root certificate by generating a CSR (Certificate Signing Request) and save the certificates to a keystore using BouncyCastle 1.5x
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.BasicConstraints;
import org.bouncycastle.asn1.x509.Extension;
import org.bouncycastle.asn1.x509.GeneralName;
import org.bouncycastle.asn1.x509.KeyUsage;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.X509v3CertificateBuilder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
@stockmind
stockmind / windows-10-hyper-v-enable-and-no-hyper-v-menu-entry.ps1
Last active July 6, 2024 15:47
Enable Hyper-V in Windows 10 and add a No Hyper-V boot entry to Windows boot loader
# Author: Simone Roberto Nunzi aka (Stockmind)
# Date: 2018/01/03
# Purpouse: Enable Hyper-V in Windows 10 and add a No Hyper-V boot entry to Windows boot loader
# References:
# https://blogs.msdn.microsoft.com/virtual_pc_guy/2008/04/14/creating-a-no-hypervisor-boot-entry/
# https://stackoverflow.com/questions/35479080/how-to-turn-windows-feature-on-off-from-command-line-in-windows-10
# https://stackoverflow.com/questions/16903460/bcdedit-bcdstore-and-powershell
#
# Launch PowerShell with administrative rights issuing Windows X + A