Skip to content

Instantly share code, notes, and snippets.

@stereokai
stereokai / gist:36dc0095b9d24ce93b045e2ddc60d7a0
Last active January 6, 2025 16:03
CSS rounded corners with gradient border
.rounded-corners-gradient-borders {
width: 300px;
height: 80px;
border: double 4px transparent;
border-radius: 80px;
background-image: linear-gradient(white, white), radial-gradient(circle at top left, #f00,#3020ff);
background-origin: border-box;
background-clip: padding-box, border-box;
}
@jboner
jboner / latency.txt
Last active January 6, 2025 16:01
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@ShirtlessKirk
ShirtlessKirk / luhn.js
Last active January 6, 2025 16:01
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,
@jackblk
jackblk / squid_proxy_tutorial.md
Last active January 6, 2025 16:01
Tutorial on how to setup a squid proxy with authentication.

Note

This tutorial is for Ubuntu & Squid3. Use AWS, Google cloud, Digital Ocean or any services with Ubuntu to follow this tutorial.

Install squid & update

sudo apt-get update
sudo apt-get install squid3
sudo apt-get install apache2-utils
@cortvi
cortvi / !Liquid Volume Shader.md
Last active January 6, 2025 16:00
Simple shader that imitates a liquid moving inside a vessel.

custom liquid shader cover image

@josephbk117
josephbk117 / Liquid.shader
Last active January 6, 2025 15:59
Unity liquid shader
/*Please do support www.bitshiftprogrammer.com by joining the facebook page : fb.com/BitshiftProgrammer
Legal Stuff:
This code is free to use no restrictions but attribution would be appreciated.
Any damage caused either partly or completly due to usage this stuff is not my responsibility*/
Shader "BitshiftProgrammer/Liquid"
{
Properties
{
_Colour ("Colour", Color) = (1,1,1,1)
_FillAmount ("Fill Amount", Range(-10,10)) = 0.0
@flga
flga / odin-gdb-pretty-printers.py
Last active January 6, 2025 15:57
GDB pretty printers for Odin types
import gdb
import re
# Set it to true if you're using Microsoft's vscode plugin for c/c++.
# This works around the fact that it doesn't handle "map" display hints properly.
enable_msft_workarounds = False
class OdinAnyPrinter(gdb.ValuePrinter):
"Pretty print Odin any."
@rvibit
rvibit / ProPlanCard.tsx
Created January 6, 2025 15:22
ProPlanCard with animated sparkles
import React from 'react';
import { View, Text, StyleSheet, Pressable, Dimensions } from 'react-native';
import { LinearGradient } from 'expo-linear-gradient';
import Animated, {
useAnimatedStyle,
withSpring,
withRepeat,
withSequence,
useSharedValue
} from 'react-native-reanimated';
@354770288
354770288 / config.yaml
Created October 12, 2024 02:59 — forked from liuran001/config.yaml
mihomo (Clash Meta) 懒人配置
# mihomo (Clash Meta) 懒人配置
# 版本 V1.8-240904
# https://gist.github.com/liuran001/5ca84f7def53c70b554d3f765ff86a33
# https://obdo.cc/meta
# 作者: 笨蛋ovo (bdovo.cc)
# Telegram: https://t.me/baka_not_baka
# 关注我的 Telegram 频道谢谢喵 https://t.me/s/BDovo_Channel
# 修改自官方示例规则 https://wiki.metacubex.one/example/#meta
# 转载请保留此注释
# 尽量添加了较为详尽的注释,不理解的地方建议对照 虚空终端 (Clash Meta) Docs 进行理解
@dfederm
dfederm / AsyncMutex.cs
Created November 3, 2022 06:44
AsyncMutex
public sealed class AsyncMutex : IAsyncDisposable
{
private readonly string _name;
private Task? _mutexTask;
private ManualResetEventSlim? _releaseEvent;
private CancellationTokenSource? _cancellationTokenSource;
public AsyncMutex(string name)
{
_name = name;