Skip to content

Instantly share code, notes, and snippets.

@Henri-lab
Henri-lab / openLayerJS.json
Last active April 28, 2024 06:22
关于openLayer JS库的snippet,陆续更新,纵享丝滑(⌐■_■)~
//将以下内容放置在vscode-用户代码片段-javascript.json文件中即可使用快捷设置
//选项难免有纰漏,您可以在此基础上修改或者自定义选项;
// ---------------OpenLayer---------------------------
{
"openlayersMap":{
"prefix": "olM",
"body": [
"new ol.Map({",
" title: ${1:title},", // 可选标题
" target: ${2:target},", // 地图的目标元素
@Siddhant-K-code
Siddhant-K-code / aws-s3-bulk-deletion.md
Created April 28, 2024 04:03
AWS S3 Bucket bulk deletion

AWS S3 Bucket bulk deletion

To utilize the AWS CLI for listing S3 buckets and deleting those that match a specific pattern, follow these steps. This guide focuses on how to remove buckets starting with the prefix "sk."

Requirements

  • AWS CLI must be installed.
  • Appropriate AWS credentials and permissions should be set up.

Step 1: Get a List of Buckets First, use the AWS CLI installed on your machine to retrieve a list of all S3 buckets.

@KlassenKonstantin
KlassenKonstantin / RubberBandSlider.kt
Created January 15, 2024 17:16
Rubber Band Slider Compose
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
setContent {
RubberBandSliderTheme {
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
Box(contentAlignment = Alignment.Center) {
RubberBandSlider(modifier = Modifier
.height(200.dp)
@o11c
o11c / every-vm-tutorial-you-ever-studied-is-wrong.md
Last active April 28, 2024 06:21
Every VM tutorial you ever studied is wrong (and other compiler/interpreter-related knowledge)

Note: this was originally several Reddit posts, chained and linked. But now that Reddit is dying I've finally moved them out. Sorry about the mess.


URL: https://www.reddit.com/r/ProgrammingLanguages/comments/up206c/stack_machines_for_compilers/i8ikupw/ Summary: stack-based vs register-based in general.

There are a wide variety of machines that can be described as "stack-based" or "register-based", but not all of them are practical. And there are a lot of other decisions that affect that practicality (do variables have names or only address/indexes? fixed-width or variable-width instructions? are you interpreting the bytecode (and if so, are you using machine stack frames?) or turning it into machine code? how many registers are there, and how many are special? how do you represent multiple types of variable? how many scopes are there(various kinds of global, local, member, ...)? how much effort/complexity can you afford to put into your machine? etc.)

  • a pure stack VM can only access the top elemen
@trvswgnr
trvswgnr / fetch-all.ts
Created July 17, 2023 08:57
concurrent fetch with retry policy
export async function fetchAll(urls: string[], concurrency = 5, retryPolicy = defaultRetryPolicy): Promise<Response[]> {
const controller = new AbortController();
const semaphore = new Semaphore(concurrency);
const promises = urls.map(async url => {
await semaphore.acquire();
try {
return await fetchWithRetry(url, retryPolicy, controller.signal);
} catch (error) {
controller.abort(); // abort all requests on fatal error
throw error;
@vishal2376
vishal2376 / FlipAnimation.kt
Created April 25, 2024 17:16
Card Flip Animation using Jetpack Compose
package com.vishal2376.animations.ui.theme
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.EaseInOut
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@mufidu
mufidu / download_imgs.py
Last active April 28, 2024 06:18
Download all images in markdown files and rename the links to point to the local files
# Download all images from all FOLDER_NAME in FOLDER_NAME folder
# and save them to FOLDER_NAME/_attachments folder.
# Then replace remote image paths with local paths.
# Usage: python download_imgs.py
import os
import urllib
import urllib.parse
import urllib.request
import re
@pyther
pyther / syslinux-install_update
Created January 9, 2011 23:25
syslinux-install_update
#!/bin/bash
#
# Sylinux Installer / Updater Scripts
# Copyright (C) 2011 Matthew Gyurgyik <pyther@pyther.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
@FreddieOliveira
FreddieOliveira / docker.md
Last active April 28, 2024 06:16
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@CHIZI-0618
CHIZI-0618 / PuerNya_sing-box_fakeip_client_config.jsonc
Last active April 28, 2024 06:14
sing-box 带有 Proxy Providers 的客户端配置示例
{
"log": {
"level": "info",
"output": "sing-box.log",
"timestamp": true
},
"dns": {
"servers": [
{
"tag": "cloudflare",