Skip to content

Instantly share code, notes, and snippets.

View blakejakopovic's full-sized avatar

Blake Jakopovic blakejakopovic

View GitHub Profile
@merill
merill / Get-LowTls.kql
Last active January 31, 2022 21:01
Gets a list of sign-ins that use older versions of TLS. This can be queried using either PowerShell or by querying log analytics. Learn more about AAD TLS deprecation today https://docs.microsoft.com/en-us/troubleshoot/azure/active-directory/enable-support-tls-environment?tabs=azure-monitor#overview-of-new-telemetry-in-the-sign-in-logs
// Interactive sign-ins only
SigninLogs
| where AuthenticationProcessingDetails has "Legacy TLS"
and AuthenticationProcessingDetails has "True"
| extend JsonAuthProcDetails = parse_json(AuthenticationProcessingDetails)
| mv-apply JsonAuthProcDetails on (
where JsonAuthProcDetails.key startswith "Legacy TLS"
| project HasLegacyTls=JsonAuthProcDetails.value
)
| where HasLegacyTls == true
@Kixunil
Kixunil / efficient_reusable_taproot_addresses.md
Last active April 14, 2023 22:07
Efficient reusable Taproot addresses

Reusable taproot addresses

Abstract

This document proposes a new scheme to avoid address reuse while retaining some of the convenience of address reuse, keeping recoverability purely from Bitcoin time chain and avoiding visible fingerprint. The scheme has negligible average overhead.

Motivation

@jeremychone
jeremychone / rust-xp-03-redis.rs
Last active September 9, 2023 06:33
Rust Redis with Async/Await (single threaded concurrency) | RustLang by example
#![allow(unused)] // silence unused warnings while exploring (to comment out)
use std::{error::Error, time::Duration};
use tokio::time::sleep;
use redis::{
from_redis_value,
streams::{StreamRangeReply, StreamReadOptions, StreamReadReply},
AsyncCommands, Client,
};
@FGRibreau
FGRibreau / HeaderValueExt.rs
Last active September 29, 2023 16:15
Convert a HeaderValue into a rust String
/// Additional conversion methods for `HeaderValue`.
pub trait HeaderValueExt {
fn to_string(&self) -> String;
}
impl HeaderValueExt for HeaderValue {
fn to_string(&self) -> String {
self.to_str().unwrap_or_default().to_string()
}
}
@tekin
tekin / .gitattributes
Last active February 23, 2024 16:46
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp
@vasilakisfil
vasilakisfil / deadpool_postgres.rs
Created July 20, 2020 11:48
deadpool postgres simple setup
use deadpool_postgres::tokio_postgres::NoTls;
use deadpool_postgres::{Config, ManagerConfig, Pool, PoolError, RecyclingMethod};
use once_cell::sync::Lazy;
use std::sync::Arc;
static DB_POOL: Lazy<Arc<Pool>> = Lazy::new(|| {
let mut cfg = Config::new();
cfg.dbname = Some(
std::env::var("DATABASE_URL")
.map_err(|_| String::from("Environment variable Database URL could not be read"))
@cfromknecht
cfromknecht / pruning.md
Last active June 28, 2021 12:18
Stricter Graph Pruning

edge count:

lncli describegraph | jq '.edges | length'

32055

node count:

lncli describegraph | jq '.nodes | length'
@FSX
FSX / script.lua
Last active December 21, 2023 15:34 — forked from chanks/script.lua
Lua script to delete/trim all processed messages from a Redis stream
-- The goal of this script is to trim messages that have been processed by
-- all extant groups from the a given Redis stream. It returns the number
-- of messages that were deleted from the stream, if any. I make no
-- guarantees about its performance, particularly if the stream is large
-- and not fully processed (so a simple XTRIM isn't possible).
-- First off, bail out early if the stream doesn't exist.
if redis.call("EXISTS", KEYS[1]) == 0 then
return false
end
@dicej
dicej / resource.rs
Last active January 12, 2023 09:49
use futures::{
future::{Future, IntoFuture},
sync::oneshot,
};
use std::{
collections::VecDeque,
sync::{Arc, Mutex},
};
struct Inner<T> {
@tonvanbart
tonvanbart / Main.java
Created August 22, 2019 11:55
Flink job showing how to create a Flink source from a websocket connection.
package com.kpn.datalab.mab;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.api.common.restartstrategy.RestartStrategies;
import org.apache.flink.api.java.utils.ParameterTool;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;