Skip to content

Instantly share code, notes, and snippets.

@ih2502mk
ih2502mk / list.md
Last active April 16, 2024 05:25
Quantopian Lectures Saved
@BlockmanCodes
BlockmanCodes / 01_v2Swap.js
Created May 8, 2023 11:54
Uniswap v2: fork mainnet and swap
const ethers = require('ethers');
const routerArtifact = require('@uniswap/v2-periphery/build/UniswapV2Router02.json')
const erc20Abi = require("../erc20.json")
const wethArtifact = require("../weth.json")
WETH_ADDRESS= '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
USDT_ADDRESS= '0xdAC17F958D2ee523a2206206994597C13D831ec7'
ROUTER_ADDRESS= '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D'
PAIR_ADDRESS= '0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852'
@k3kdude
k3kdude / DiscordWebhook.java
Created August 17, 2017 15:31
Java DiscordWebhook class to easily execute Discord Webhooks
import javax.net.ssl.HttpsURLConnection;
import java.awt.Color;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Array;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@manning-ncsa
manning-ncsa / Readme.rst
Created April 18, 2021 17:59
Syncthing deployment on Kubernetes

Syncthing Device for a Persistent Peer

Overview

Syncthing provides a way to share arbitrary numbers of files between any number of people without the need for a central server. It is a peer-to-peer (P2P) application that automagically syncs files in the background. This deployment app launches a Syncthing "device" (Persistent Peer) that offers a high-availability peer for members of a team to include in their file shares.

For example, imagine there are three people in a team who want to share various folders with each other during the course of their work. They can accomplish this with Syncthing using only their three workstations, by exchanging Device IDs and sharing the folders. However, what if one person modifies or adds a file while the other two are offline, and then that person goes offline before the other two come online? In that event, they would not receive the update. This is where a Persistent Peer is helpful, because in

@defulmere
defulmere / settings.py
Last active April 16, 2024 05:20
How to override an old sqlite3 module with pysqlite3 in django settings.py
# ⚠️ USE AT YOUR OWN RISK
# first: pip install pysqlite3-binary
# then in settings.py:
# these three lines swap the stdlib sqlite3 lib with the pysqlite3 package
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
DATABASES = {
@hakerdefo
hakerdefo / sources.list
Created June 11, 2023 18:47
Debian 12 "bookworm" complete sources.list
deb https://ftp.debian.org/debian/ bookworm contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ bookworm-backports contrib main non-free non-free-firmware
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active April 16, 2024 05:14
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@Jaseemakhtar
Jaseemakhtar / CicularRevealMenu.kt
Created December 5, 2021 04:21
Android Jetpack Compose Custom menu, which align items in circular fashion.
@Composable
fun CircularRevealMenu(
modifier: Modifier,
contentPadding: Dp = 16.dp,
circleRadius: () -> Float,
content: @Composable () -> Unit
) {
val configuration = LocalConfiguration.current
Layout(content = content, modifier = modifier) { children, constraints ->
@yostos
yostos / moderate
Created June 10, 2023 11:55
OpenAIのModeration APIを使って標準入力のテキストに含まれる問題発言を検知してくれるフィルターコマンド
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# OpenAI Moderation APIを呼び出し、標準入力からのテキストの問題発言を評価する。
# 使い方: moderate < input.txt > output.txt
# cat input.txt | moderate > output.txt
# 必要モジュールのインポート
import sys
import os
from dotenv import load_dotenv
@ardakazanci
ardakazanci / CircularMenuGroup.kt
Created April 10, 2024 07:33
Circular Menu Group with Jetpack Compose
@Composable
fun CircularMenuGroup(
icons: List<ImageVector>,
baseRadius: Float,
modifier: Modifier = Modifier,
backgroundColor: Color = Color(0xFF21FA90),
shadowElevation: Dp = 4.dp
) {
var selectedIndex by remember { mutableIntStateOf(-1) }
var sizeSliderValue by remember { mutableFloatStateOf(1f) }