export class Cache<T extends object, K> { | |
items = new WeakMap<T, K>() | |
get<P extends T>(item: P, cb: (item: P) => K) { | |
if (!this.items.has(item)) { | |
this.items.set(item, cb(item)) | |
} | |
return this.items.get(item)! | |
} |
import com.google.common.graph.Graphs | |
import com.google.common.graph.MutableValueGraph | |
import com.google.common.graph.ValueGraphBuilder | |
import org.gradle.api.DefaultTask | |
import org.gradle.api.Project | |
import org.gradle.api.artifacts.Configuration | |
import org.gradle.api.artifacts.ProjectDependency | |
import org.gradle.api.tasks.Input | |
import org.gradle.api.tasks.TaskAction | |
import org.gradle.api.tasks.options.Option |
I feel somewhat pressed to give a negative review of this book. This comes from someone who has worked on various Lisp implementations, and written some amount of C, but that isn’t an excuse to be overly harsh. This book, however, does not provide many nice things to say, and plenty of un-nice things. My apologies in advance.
First off: God help you if you are going to write your first interpreter in C of all things. No one I know thinks it’s a good idea to start
import android.os.Build.VERSION.SDK_INT | |
import android.os.Bundle | |
import android.os.Parcel | |
import android.util.Base64 | |
/** | |
* This class implements a fix for https://issuetracker.google.com/issues/147246567 | |
* Investigation: https://twitter.com/Piwai/status/1374129312153038849 | |
* | |
* Usage: |
To convert animation GIF to MP4 by ffmpeg, use the following command
ffmpeg -i animated.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.mp4
movflags – This option optimizes the structure of the MP4 file so the browser can load it as quickly as possible.
pix_fmt – MP4 videos store pixels in different formats. We include this option to specify a specific format which has maximum compatibility across all browsers.
apply from: "../jacoco.gradle" | |
def debugTree = fileTree(dir: "${buildDir}/intermediates/packaged-classes/flavorUnsigned", includes: includeFileFilter, excludes: excludeFileFilter) | |
def kotlinDebugTree = fileTree(dir: "${buildDir}/tmp/kotlin-classes/flavorUnsignedDebug", includes: includeFileFilter, excludes: excludeFileFilter) | |
def mainSrc = "${project.projectDir}/src/main/java" | |
task jacocoTestReport(type: JacocoReport, dependsOn: ['testFlavorUnsignedDebugUnitTest', 'assembleDebug']) { | |
reports { | |
xml.enabled = true |
to ask for help with python and/or executing this script, join discord: https://discord.gg/zpu7YUP3Um
There's not telegram API method for this, we need to call MTProto methods to retrieve messages from the "Recent Actions" (Admin Log) since deleted messages (and medias) gets moved there for 48 hours before the permanent deletion.
from telethon import TelegramClient, events, sync
from telethon.tl.types import InputChannel, PeerChannel
#!/bin/bash | |
set -e | |
# CI Cache Script for Google Cloud Storage | |
# TIP: Set CI_CACHE_VERBOSE=true while testing the script | |
# to show a list of all files that are compressed/extracted. | |
# Note that you might see "tar: write error" if there are too many | |
# files in the verbose output. |