Skip to content

Instantly share code, notes, and snippets.

View alexanderankin's full-sized avatar

David Ankin alexanderankin

View GitHub Profile
#include "stdio.h"
int InBlock[81], InRow[81], InCol[81];
const int BLANK = 0;
const int ONES = 0x3fe; // Binary 1111111110
int Entry[81]; // Records entries 1-9 in the grid, as the corresponding bit set to 1
int Block[9], Row[9], Col[9]; // Each int is a 9-bit array
https://plugins.jetbrains.com/plugin/download?rel=true&updateId=424435
# https://stackoverflow.com/q/24044513
wget -qO- https://plugins.jetbrains.com/files/$(curl https://plugins.jetbrains.com/api/plugins/4415/updates | jq -r '.[0].file') | bsdtar -xvf- -C ~/.PhpStorm2018.3/config/plugins
https://plugins.jetbrains.com/api/plugins/17718/updates
file=$(curl https://plugins.jetbrains.com/api/plugins/17718/updates -fSsL | jq .[0].file -r)
curl -O https://plugins.jetbrains.com/files/$file
# https://docs.pydantic.dev/latest/concepts/pydantic_settings/#adding-sources
from typing import Any
from pydantic.fields import FieldInfo, Field
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource, SettingsConfigDict,
)
// example-config-data/src/main/java/org/example/config_data_source/ExampleConfigData.java
package org.example.config_data_source;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.config.*;
import org.springframework.core.env.MapPropertySource;
@alexanderankin
alexanderankin / fix-discord-for-ubuntu-unity.sh
Last active October 22, 2023 07:02
How to fix the tray icon for ubuntu unity
#!/usr/bin/env bash
sudo sed -i "/^Exec/s#.*#Exec=env XDG_CURRENT_DESKTOP='' /usr/share/discord/Discord#" /usr/share/applications/discord.desktop
sudo xdg-desktop-menu install --novendor --mode system /usr/share/applications/discord.desktop
# Q: how do i fix discord so the icon appears in the tray again for ubuntu unity
# A: run this script

Client Assertion

Explains how to do Azure Authentication with OAuth "client credentials" grant with a Client Assertion.

pip install python-jose jwt cryptography

references:

import hashlib
import pathlib
import subprocess
from cryptography.x509 import load_pem_x509_certificate
from cryptography.hazmat.primitives.serialization import Encoding
from cryptography.hazmat.backends import default_backend
# openssl req -new -newkey rsa:2048 -sha256 -nodes -x509 -keyout demo.key -out demo.crt -subj "/CN=foo"
# Read the JSON file into a string
$jsonString = Get-Content -Raw "file.json"
# Convert the JSON string to a PowerShell object
$jsonObject = ConvertFrom-Json $jsonString
# Modify the JSON object as needed
$jsonObject.abc = $true
# Convert the modified object back to a JSON string
# Define custom function directory
ARG FUNCTION_DIR="/function"
FROM node:18-buster as build-image
# Include global arg in this stage of the build
ARG FUNCTION_DIR
# Install aws-lambda-cpp build dependencies
RUN apt-get update && \
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<includedPredefinedLibrary name="Node.js Core" />
</component>
</project>