Skip to content

Instantly share code, notes, and snippets.

View typelogic's full-sized avatar
🏹

typelogic typelogic

🏹
View GitHub Profile
@typelogic
typelogic / LocateMe.swift
Created May 16, 2022 04:38 — forked from cmittendorf/LocateMe.swift
A command line tool for Mac OS X written in Swift that uses CoreLocation for reverse geocoding a location from latitude and longitude. The geocoding part of this script will work on OS X as well as iOS.
#!/usr/bin/env swift
// Run this command line tool as a dynamic script or compile a binary
// using the following command:
// swiftc -sdk `xcrun --show-sdk-path` LocateMe.swift
import Cocoa
import CoreLocation
extension String {
@typelogic
typelogic / purging-old-artifacts-with-github-api.md
Created February 1, 2022 13:56 — forked from lelegard/purging-old-artifacts-with-github-api.md
Purging old artifacts with GitHub Actions API

With GitHub Actions, a workflow can publish artifacts, typically logs or binaries. As of early 2020, the life time of an artifact is hard-coded to 90 days (this may change in the future). After 90 days, an artifact is automatically deleted. But, in the meantime, artifacts for a repository may accumulate and generate mega-bytes or even giga-bytes of data files.

It is unclear if there is a size limit for the total accumulated size of artifacts for a public repository. But GitHub cannot reasonably let multi-giga-bytes of artifacts data accumulate without doing anything. So, if your workflows regularly produce large artifacts (such as "nightly build" procedures for instance), it is wise to cleanup and delete older artifacts without waiting for the 90 days limit.

Using the Web page for the "Actions" of a repository, it is possible to browse old workflow runs and manually delete artifacts. But the procedure is slow and tedious. It is fine to delete one selected artifact. It is not for a regular cleanup. We need

@typelogic
typelogic / verify.safetynet.webauthn.js
Created November 24, 2021 15:29 — forked from herrjemand/verify.safetynet.webauthn.js
WebAuthn Android SafetyNet attestation verification sample in NodeJS
const crypto = require('crypto');
const base64url = require('base64url');
const cbor = require('cbor');
const jsrsasign = require('jsrsasign');
let gsr2 = 'MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9iYWxzaWduLm5ldC9yb290LXI
@typelogic
typelogic / android_permisions.xml
Created November 23, 2021 08:27 — forked from ali5h/android_permisions.xml
Android permisions list for a non-system app
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE"/>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
@typelogic
typelogic / 01-createObservableFromDeviceEventEmitter.js
Created November 15, 2021 14:20 — forked from sectore/01-createObservableFromDeviceEventEmitter.js
[React Native + RxJS] Create an Observable from DeviceEventEmitter - An example to handle 'locationUpdated' event
import React, {DeviceEventEmitter} from 'react-native';
import {Observable} from 'rx-lite'
/**
* Creates an Observable to listen to any event of DeviceEventEmitter
* @param type {string} Event type
*/
export default createObservableFromDeviceEventEmitter$ = type => {
let subscription;
return Observable.fromEventPattern(
@typelogic
typelogic / Iterate days
Created January 9, 2021 14:27 — forked from CaptainJH/Iterate days
Output date string in C++
/// iterate from fromD(like "2014-04-02") to toD("2014-05-02")
std::string tpStr = fromD;
do {
//std::cout << tpStr << std::endl;
ParseIntoUserInfoDB(tpStr, root, order);
std::tm tm;
std::stringstream ss(tpStr + " 0:0:1");
ss >> std::get_time(&tm, "%Y-%m-%d %H:%M:%S");
auto tp = std::chrono::system_clock::from_time_t(std::mktime(&tm));
@typelogic
typelogic / publish-maven-central-repo-sonatype.md
Created January 6, 2021 02:46 — forked from diegopacheco/publish-maven-central-repo-sonatype.md
How to publish a JAR into Sonatype Maven Central REPO?

How to publish a jar into Sonatype central repo

Order of Operations

  1. Create gpg key
  2. Export gpg key
  3. Publish gpg key to ubuntu server
  4. Create account at Sonatype JIRA
  5. Configure $HOME/.gradle/settings.gradle user and pass and keys settings
  6. Configure gradle plugins
@typelogic
typelogic / opencv-4.2.0-cuda-10.1-Ubuntu-20.04.md
Created November 14, 2020 14:31 — forked from nathzi1505/opencv-4.2.0-cuda-10.1-Ubuntu-20.04.md
Step-by-Step Guide to build OpenCV 4.2.0 with CUDA 10.1 on Ubuntu 20.04

How to install OpenCV 4.2.0 with CUDA 10.1 on Ubuntu 20.04 LTS (Focal Fossa)

Install updates and upgrade your system:

    $ sudo apt update
    $ sudo apt upgrade

Install required libraries:

Publish AAR to jCenter and Maven Central
=================
[![Twitter](https://img.shields.io/badge/Twitter-@LopezMikhael-blue.svg?style=flat)](http://twitter.com/lopezmikhael)
Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:
1. I use "Android Studio" and I have this simple android lib that I would like to be available on maven: [CircularImageView](https://github.com/lopspower/CircularImageView)
2. In the library folder(module) I have the lib code abovementioned. And applying in the build.gradle of this folder `apply plugin: 'com.android.library'` I got as output an .aar in the build/outputs/aar/ directory of the module's directory
@typelogic
typelogic / gradlesigning.md
Created November 9, 2020 07:58 — forked from phit/gradlesigning.md
Gradle Signing for Dummies

Setup

Windows

Download the GnuPG binary release for windows current version from the official site and install it.

Linux

Grab the latest gpg from your package manager if it's not installed already anyway ;)