Skip to content

Instantly share code, notes, and snippets.

View pabloogc's full-sized avatar

Pablo Orgaz pabloogc

  • Toledo, Spain
View GitHub Profile
@pabloogc
pabloogc / uuid7.ts
Last active May 9, 2022 19:40
Function for generating uuid v7 on Postgres as defined in the RFC https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format#section-5.2
export function uuid7(): UUID {
// Simple implementation using built in gen_random_uuid()
// gen_random_uuid(): '4047541d-a7bf-4d8a-87c2-585cab7ef52e'
// strip random head and version: '_______________d8a-87c2-585cab7ef52e'
// concatenate epoch and version 7: 'xxxxxxxx-xxxx-7d8a-87c2-585cab7ef52e
const v4 = uuid.v4().slice(8 + 4 + 2 + 1, 36);
const date = Date.now().toString(16).padStart(12, '0');
return date.slice(0, 8) + '-' + date.slice(8, 8 + 5) + '-7' + v4;
}
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0
#IfWinActive, ahk_class POEWindowClass
active:=true
`::
active:=!active
return
$2::
if(!active) {
send, 2
import java.util.*
import kotlin.reflect.KProperty
class MutableFieldProperty<R, T : Any>(private val initializer: (R) -> T) {
private val map = WeakHashMap<R, T>()
operator fun getValue(thisRef: R, property: KProperty<*>): T =
map[thisRef] ?: setValue(thisRef, property, initializer(thisRef))
operator fun setValue(thisRef: R, property: KProperty<*>, value: T): T {
map[thisRef] = value
@pabloogc
pabloogc / CryptoFileCache.kt
Created June 6, 2017 16:18
Fresco + Conceal, Image Loading with encrypted cache
import com.facebook.binaryresource.BinaryResource
import com.facebook.cache.common.CacheKey
import com.facebook.cache.common.WriterCallback
import com.facebook.cache.disk.FileCache
import com.facebook.crypto.Crypto
import com.facebook.crypto.Entity
import java.io.InputStream
fun configureFresco() {
val frescoConfig = ImagePipelineConfig.newBuilder(context)
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DaggerOverride {
Class<?> value();
set PATH /home/pablo/development/android-studio/bin $PATH
set PATH /home/pablo/development/flatbuffers-1.1.0 $PATH
set PATH /home/pablo/Android/Sdk/platform-tools/ $PATH
set PATH /home/pablo/Android/Sdk/tools/ $PATH
set PATH /home/pablo/.gem/ruby/1.9.1/bin $PATH
set PATH /home/pablo/Android/NDK $PATH
set PATH /home/pablo/.cargo/bin $PATH
set PATH /home/pablo/swift-2.2/usr/bin $PATH
set -g -x CC /usr/bin/clang
==== Warrior ====
UI:
dmepObqjPcQgfcfNsjvUfjP2Lqsmmj4yuvwMuPNrsmnQQCnsQTPK03OQQXjvOZjHQ5jvq5Eiuk2hcLshujLfkrpuczIKK4IkPQnQKOpIqPAKcjvNuQOzsss3eHs2Ps9tuXqfsSuH4PQMQixvQaBvij5RkjmxHKYEH)kvnyPuhwulwi1JPktMexMYMvIpJQgTuCAKwTqsQxlHYSr52iA3u53KA4c1YL0ZvmDIRly7iKVJGXJq15rLwVubz)sjdFiHNrcc(G3nQ4lQuiQ4BvCsCfCfKW5YzzzmbBv7tf14JXwIIM6e8soPehILQU(vMWRgpv7sCJnC(QoeJ7cKPkLN3Qd2(WPk4RixRuDTv71c18GZ0zfKWvOlluVat4IeozGjuKGabVM9mKWjdmHIeei4HX69y5zWLAWWLmZCcs4KbMqrcceCpwEgKWhQJNz4RyTir6Ktei4vnZqcNmWeksqGab3iEC2PykiAi4EiHTpKW5YzzzmbBvRgN6PDiA8fTtwjlZp4C6GKQ25E94mDwbjCjZmNGeozGjuKGab3JLNbj8H64zg(kwlsKo5ebcUcDzH6fycxKWjdmHIeei4vnZqcNmWeksqGGpXMhs4d1XZmSvbNmWeksy7dLqGGhgR3JLNbL4HX690KrNfuIxZEgs4KbMqrccei4vJNQDjUXgEouZrNR4cL0QRu7e81ZiQd6Sv7vQDcUcDIzzUjJ4IQAlcER24sLYZBvKWfUXg(izjm4bNrK5e8Cq04grMtWJIMGvX9cJOj7BOkgUqjnf8Wy9bhvqje8gJY3iy7RJrf14UazQs55T6GTpCHsA1t7qg2D7ItvWJK5nCcufPb7Uf6cb7UiHZLZYYyc2(JVODYkzz(bNthKu1o3Rhp6CTintxrcBFyxa7Uy7dBvWkxTRVv9xfvwTGkD9VB3cfhlQwTAi4mDwbjCjZmNGeozGjuKGab3JLNbj8H64zg(kwlsKo5ebcUcDzH6fycxKWjdmHIeei41
@pabloogc
pabloogc / checkstyle.xml
Last active October 19, 2015 07:38
checkstyle.xml
<?xml version="1.0"?><!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<!--module name="NewlineAtEndOfFile"/-->
<module name="FileLength" />
<module name="FileTabCharacter" />
<!-- Trailing spaces -->
@pabloogc
pabloogc / Logcatpls
Last active January 6, 2019 06:38
Regex for Android Studio filter
^((?!ResourcesManager|InputEventReceiver|PopupWindow|MaliEGL|PhoneWindow|GraphicBuffer|.MALI..Gralloc.|InputMethodManager|libc-netbsd|NativeCrypto|OpenSSLLib|VelocityTracker|Posix|View|System.out|ADB_SERVICES|BatteryMeterView|BufferQueue|dalvikvm|ActivityThread|PowerManagerService|SurfaceFlinger|OpenGLRenderer|ANRManager|InputReader|PhoneInterfaceManagerEx|PowerManagerNotifier|KeyguardUpdateMonitor|WifiStateMachine|PowerManagerDisplayController|WifiHW|AppOps|StatusBar\.NetworkController|dingtao_Resolver|Provider.Settings|System.out|SignalClusterView|wpa_supplicant|SurfaceFlinger|Tethering|SIMHelper|wifi).)*$