Skip to content

Instantly share code, notes, and snippets.

View 1912UWPBLE_3.cs
public class AdvertisementListItem
{
public ulong BluetoothAddress;
public string AdvertisementData;
public AdvertisementListItem(BluetoothLEAdvertisementReceivedEventArgs eventArgs)
{
BluetoothAddress = eventArgs.BluetoothAddress;
var dataSections = eventArgs.Advertisement.DataSections;
foreach (BluetoothLEAdvertisementDataSection dataSection in dataSections)
View Working With Strings: drills
https://repl.it/@lawstonwalker/text-normalizer-drill
https://repl.it/@lawstonwalker/shouter-drill
https://repl.it/@lawstonwalker/Wiseperson-generator-drill-1
@willin
willin / proxy.d.ts
Last active Dec 12, 2019
proxy.d.ts
View proxy.d.ts
//定义proxy中必须实现的handler参数接口
interface ProxeeHandler<T extends object, TOut extends object> {
get?<K extends keyof TOut>(target: T, p: K, receiver: TOut): TOut[K];
set?<K extends keyof TOut>(target: T, p: K, value: TOut[K], receiver: TOut): boolean;
}
//定义proxy的构造函数接口
interface ProxeeConstructor {
new <T extends object, TOut extends object>(target: T, handler: ProxeeHandler<T, TOut>): TOut;
}
//用以上两个接口声明一个Proxee,其用法和Proxy一模一样
View untrusted-lvl6-solution.js
/****************
* drones101.js *
****************
*
* Do you remember, my dear Professor, a certain introductory
* computational rationality class you taught long ago? Assignment
* #2, behavior functions of autonomous agents? I remember that one
* fondly - but attack drones are so much easier to reason about
* when they're not staring you in the face, I would imagine!
View untrusted-lvl8-solution.js
/*******************
* intoTheWoods.js *
*******************
*
* Ah, you're out of the woods now. Or into the woods, as the
* case may be.
*
* So take a deep breath, relax, and remember what you're here
* for in the first place.
*
View 1912UWPBLE_2.cs
private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher watcher,
BluetoothLEAdvertisementReceivedEventArgs eventArgs)
{
//アドバタイズ受信した際の処理
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
//同要素がなければListに追加
AdvertisementListItem item = new AdvertisementListItem(eventArgs);
if (AdvertisementList.Select(x => x.BluetoothAddress).Where(x => x.Equals(item.BluetoothAddress)).Count() == 0)
{
@aruruka
aruruka / kubernetes_troubleshooting_reference.md
Created Dec 12, 2019
Troubleshooting bash code snippet for Kubernetes cluster administration.
View kubernetes_troubleshooting_reference.md

kubeadm相关

主机有双网卡,默认网卡为外网网卡,集群内通信使用内网网卡

尝试从 apiServer 参数--advertise-address和 kubelet 参数--node-ip入手。

一个出错的典型场景:

比如在物理机上通过 vagrant 创建虚拟机部署 k8s 集群,虚拟机默认可能会配置一张 NAT 网卡作为默认网卡且这个 ip 可能是一样的,那可能多个虚拟机的的默认网卡的 ip 都是一样的。

kube-dns 相关

kube-dns 的 service ip 更改导致集群内服务发现功能不可用

@HugsLibRecordKeeper
HugsLibRecordKeeper / output_log.txt
Created Dec 12, 2019
Rimworld output log published using HugsLib
View output_log.txt
Log uploaded on Thursday, December 12, 2019, 10:24:45 AM
Loaded mods:
Core: (no assemblies)
Mod Manager: 0ColourPicker(2.0.0.22137), 0Harmony(1.2.0.1), FluffyUI(1.0.0.22965), ModManager(av:1.0.0.0,fv:1.31.872), YamlDotNet(av:6.0.0.0,fv:6.1.2.0)
Startup impact: 0Harmony(1.2.0.1), StartupImpact(1.1.7027.12912)
Startup_impact_zh: (no assemblies)
RIMMSLoadUp: 0Harmony(1.2.0.1), RIMMSLoadUp(1.0.7040.29929)
RuntimeGC: RuntimeGC(20.0.15.1)
Lolidrop's hairshop: (no assemblies)
Work Tab: 0Harmony(1.2.0.1), FluffyUI(1.0.0.40421), WorkTab(av:3.0.0.0,fv:3.9.285)
View workInfo.swift
class WorkInfo: Object{
@objc dynamic var title: String?
@objc dynamic var content: String?
let seq = RealmOptional<Int>()
// ...
}
View gist:bc7af6d7ff0ee2e3f61529b239b7ec32
class DepthPageTransformer: ViewPager.PageTransformer {
companion object {
private const val MIN_SCALE = 0.75f
}
override fun transformPage(view: View, position: Float) {
when {
position < -1 -> // [-Infinity,-1)
// This page is way off-screen to the left.
view.alpha = 0f
You can’t perform that action at this time.