Skip to content

Instantly share code, notes, and snippets.

@av
av / main.dart
Last active July 17, 2024 21:26
Flutter: texture generator playground
import 'dart:async';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
void main() async => runApp(MaterialApp(home: Root()));
/// Waits till [ui.Image] is generated and renders
/// it using [CustomPaint] to render it. Allows use of [MediaQuery]
class Root extends StatelessWidget {
@draveness
draveness / golang-syscall.csv
Created September 6, 2019 07:39
golang syscall type
Syscall Type
SYS_TIME RawSyscall
SYS_GETTIMEOFDAY RawSyscall
SYS_SETRLIMIT RawSyscall
SYS_GETRLIMIT RawSyscall
SYS_EPOLL_WAIT Syscall
SYS_MMAP2 Syscall
SYS__NEWSELECT Syscall
SYS_SETGROUPS32 RawSyscall
SYS_GETGROUPS32 RawSyscall
@Prnyself
Prnyself / cp.go
Created August 8, 2019 10:17
set params from cmd
package main
import (
"github.com/spf13/cobra"
"github.com/yunify/qsctl/v2/action"
"github.com/yunify/qsctl/v2/utils"
)
// CpCommand will handle copy command.
@ppth0608
ppth0608 / TimeInterval+Project.swift
Created July 3, 2019 04:02
How to convert TimeInterval to Milliseconds or Seconds
import Foundation
extension TimeInterval {
var seconds: Int {
return Int(self.rounded())
}
var milliseconds: Int {
return Int(self * 1_000)
@mshafer
mshafer / ContentView.swift
Last active June 20, 2025 00:36
Slide-over card (like in Maps or Stocks) using SwiftUI
import SwiftUI
struct ContentView : View {
var body: some View {
ZStack(alignment: Alignment.top) {
MapView()
SlideOverCard {
VStack {
CoverImage(imageName: "maitlandbay")
Text("Maitland Bay")
@antfarm
antfarm / CRC32.swift
Last active June 28, 2025 13:22
CRC32 checksum generation in a few lines of Swift 5. https://en.wikipedia.org/wiki/Cyclic_redundancy_check#CRC-32_algorithm
class CRC32 {
static var table: [UInt32] = {
(0...255).map { i -> UInt32 in
(0..<8).reduce(UInt32(i), { c, _ in
(c % 2 == 0) ? (c >> 1) : (0xEDB88320 ^ (c >> 1))
})
}
}()
@axdotl
axdotl / helm-values.yaml
Last active December 29, 2023 23:10
Helm example values for stable/jenkins v1.1.17
master:
useSecurity: true
adminUser: "admin"
fsGroup: 1000
runAsUser: 1000
serviceType: ClusterIP
installPlugins:
@logbase2
logbase2 / get_sdl.sh
Created April 29, 2019 03:20
Build script for building SDL2 and extensions for iOS, tvOS and macOS
#!/bin/bash
#
# usage: Make executable and type ./get_sdl.sh
#
# Note - Use -showBuildSettings such as:
# xcodebuild -configuration Release HEADER_SEARCH_PATHS="../../SDL/include/ ./Frameworks/FreeType.framework/Headers/" -target "Static Library" -arch x86_64 -sdk macosx -showBuildSettings
# to list all build settings...
#
# Note - Had to update the HEADER_SEARCH_PATHS and MACOSX_DEPLOYMENT_TARGET for
# a couple of libraries for the macOS versions. The HEADER_SEARCH_PATHS were set to look
@jebright
jebright / main.dart
Created April 16, 2019 19:12
Using an Isolate in Flutter
import 'dart:async';
import 'package:flutter/material.dart';
import 'dart:isolate';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
@Wang-Kai
Wang-Kai / ladon_vs_casbin.md
Last active January 15, 2025 12:26
ladon & casbin 两个 authorization 库的比较

通览了 casbin 的文档,结合先前对 AWS IAM 的理解,以及对 ladon SDK 的使用,总结对比一下 Ladon & Casbin 两个授权库。

1. 项目定位

先对比两个项目的简介:

ladon

A SDK for access control policies: authorization for the microservice and IoT age. Inspired by AWS IAM policies. Written for Go.