This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Author: Diego Valle-Jones | |
# Web: http://www.diegovalle.net | |
# Script to download shapefiles from 2020 Mexican census (including demographic data) | |
# tested on ubuntu 20.04 | |
# Exit on error, undefined and prevent pipeline errors | |
set -euo pipefail | |
IFS=$'\n\t' | |
# The directory from which the script is running |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Released by rdb under the Unlicense (unlicense.org) | |
# Based on information from: | |
# https://www.kernel.org/doc/Documentation/input/joystick-api.txt | |
import os, struct, array | |
from fcntl import ioctl | |
# Iterate over the joystick devices. | |
print('Available devices:') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CoreImage | |
static func createQR(fromString: String) -> CIImage? | |
{ | |
let stringData = fromString.data(using: .utf8) | |
let filter = CIFilter(name: "CIQRCodeGenerator") | |
filter?.setValue(stringData, forKey: "inputMessage") | |
filter?.setValue("H", forKey: "inputCorrectionLevel") | |
let qrCodeImage = filter?.outputImage | |
let imageByTransform = qrCodeImage?.transformed(by: CGAffineTransform(scaleX: 15.0, y: 15.0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cfdi = '<?xml version="1.0" encoding="UTF-8"?> | |
<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nomina="http://www.sat.gob.mx/nomina" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv32.xsd http://www.sat.gob.mx/nomina http://www.sat.gob.mx/sitio_internet/cfd/nomina/nomina11.xsd" version="3.2" fecha="2015-11-06T18:15:32" folio="123 - 1063" serie="A" subTotal="24113.81" descuento="0.00" motivoDescuento="Deducciones de nómina" total="20000.00" Moneda="MXN" condicionesDePago="Contado" NumCtaPago="No identificado" tipoDeComprobante="egreso" noCertificado="00001000000307566366" certificado="MIIFNzCCBB+gAwIBAgIUMDAwMDEwMDAwMDAzMDc1NjYzNjYwDQYJKoZIhvcNAQELBQAwggGKMTgwNgYDVQQDDC9BLkMuIGRlbCBTZXJ2aWNpbyBkZSBBZG1pbmlzdHJhY2nDs24gVHJpYnV0YXJpYTEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc3RyYWNpw7NuIFRyaWJ1dGFyaWExODA2BgNVBAsML0FkbWluaXN0cmFjacOzbiBkZSBTZWd1cml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSRegularExpression { | |
func actuallyUsableMatch(in string: String) -> (fullMatch: String, captures: [String])? { | |
let nsString = string as NSString | |
let range = NSMakeRange(0, nsString.length) | |
guard let match = firstMatch(in: string, range: range) else { | |
return nil | |
} | |
let fullMatch = nsString.substring(with: match.range) | |
var captures: [String] = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du -hx --max-depth=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open Search and Replace | |
Find: ( {4}) | |
Where: -vendor/*,-bootstrap/* | |
Replace: \t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// taken from http://stackoverflow.com/a/41923217 | |
extension MKPolygon { | |
func contain(coor: CLLocationCoordinate2D) -> Bool { | |
let polygonRenderer = MKPolygonRenderer(polygon: self) | |
let currentMapPoint: MKMapPoint = MKMapPointForCoordinate(coor) | |
let polygonViewPoint: CGPoint = polygonRenderer.point(for: currentMapPoint) | |
return polygonRenderer.path.contains(polygonViewPoint) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# taken from: http://jezenthomas.com/free-internet-on-trains/ | |
# it goes into the .bashrc | |
function remac { | |
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z | |
sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//') | |
sudo networksetup -detectnewhardware | |
echo $(ifconfig en0 | grep ether) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
echo better_crypt("password"); | |
if(password_verify("password", better_crypt("password"))) { | |
// password is correct | |
echo "<br><br>"; | |
echo "password correct"; | |
} | |
function better_crypt($input, $rounds = 8) | |
{ |
NewerOlder