Skip to content

Instantly share code, notes, and snippets.

@lyc8503
lyc8503 / bilibili_share.user.js
Last active May 26, 2025 05:16
已被 bilibili 制裁并无法修复,仅供技术学习,后续不会更新
// ==UserScript==
// @name Bilibili share
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Bilibili share
// @author You
// @match *://www.bilibili.com/bangumi/play/*
// @match *://www.bilibili.com/video/*
// @connect api.bilibili.com
// @icon https://www.bilibili.com/favicon.ico
@rm3l
rm3l / mid_circle_radial_gauge.dart
Last active June 17, 2021 14:32
Sample code for creating a mid-circle radial gauge widget with Flutter. See https://rm3l.org/creating-a-mid-circle-radial-gauge-in-flutter/ for more details.
import 'dart:math';
import 'package:flutter/material.dart';
class MyCustomRadialGauge extends StatefulWidget {
@override
_MyCustomRadialGaugeState createState() => _MyCustomRadialGaugeState();
}
class _MyCustomRadialGaugeState extends State<MyCustomRadialGauge>
@jstott
jstott / userGeoLocation.js
Created August 13, 2020 02:24
Detect User's Current Location Using HTML5 Geolocation
// Since this can compromise privacy, the position is not available unless the user approves it.
function get_location() {
try {
navigator.geolocation.watchPosition((pos) => {
try {
var coords = pos.coords;
} catch {
var coords = false;
}
if (!coords) {
@loushou
loushou / main.dart
Last active October 31, 2021 18:22
Flutter - Programmatically trigger button without directly tapping it #flutter #statemanagement #provider
/*
The goal of this is to show you how to abstract the action of tapping a button,
such that it can be triggered from some other code. In this case we trigger one
button's action from tapping another button... but the principle should carry
over if you are triggering it from somewhere else in the code as well, possibly
not related to a user button tap (maybe after a certain amount of time, or when
another state updates elsewhere in the code).
*/
// this package provides the state management utilities we need for this magic to happen
@salamanders
salamanders / DoubleExponentialSmoothing.kt
Created April 10, 2019 20:09
Double Exponential Smoothing in Kotlin
package info.benjaminhill.basicbot2
import java.util.concurrent.ThreadLocalRandom
/**
* From https://geekprompt.github.io/Java-implementation-for-Double-Exponential-Smoothing-for-time-series-with-linear-trend/
*
* Performs double exponential smoothing for given time series.
*
import 'package:flutter/material.dart';
import 'package:csv/csv.dart';
import 'dart:async' show Future;
import 'package:flutter/services.dart' show rootBundle;
class TableLayout extends StatefulWidget {
@override
_TableLayoutState createState() => _TableLayoutState();
}
@phil-kahrl
phil-kahrl / recursive-s3-list.js
Last active February 18, 2022 01:46
Recursive function for listing contents of an S3 bucket
const AWS = require('aws-sdk');
const s3 = new AWS.S3({ apiVersion: '2006-03-01', region: 'us-east-1' });
/**
Recursive method to list all the objects in an S3 bucket which may be paginated.
**/
const listObjects = (
resultList, // This is the list of combined results from all calls.
NextContinuationToken // Tells S3 to get the next page of results.
@sam016
sam016 / AllGattCharacteristics.java
Last active July 29, 2025 16:00
Bluetooth GATT Services & Characteristics
package com.sam016.vsflatomation.service.ble;
import java.util.HashMap;
import java.util.UUID;
public class AllGattCharacteristics {
private static HashMap<String, String> attributes = new HashMap();
static {
attributes.put("00002a00-0000-1000-8000-00805f9b34fb", "Device Name");
@kantapp
kantapp / fullscreen.kt
Created March 31, 2018 08:15
show/hide android status bar using kotlin
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash_screen)
//make Activity fullscreen /*hide Status bar*/
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN)
val button=findViewById<Button>(R.id.button)
button.setOnClickListener {
//Back Activity to normal screen /*Show Status bar*/
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
@maiconhellmann
maiconhellmann / UnsafeOkHttpClient.kt
Last active August 26, 2024 13:06
UnsafeHttpClient wrote in Kotlin
import android.annotation.SuppressLint
import okhttp3.OkHttpClient
import java.security.cert.CertificateException
import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
object UnsafeOkHttpClient {
fun Builder(): OkHttpClient.Builder {
try {