Skip to content

Instantly share code, notes, and snippets.

@yosriady
yosriady / DESIGN.md
Last active January 17, 2025 07:13
OAuth2 Authentication Microservices Design

Auth

Disclaimer

Creating an OAuth2 server is not a task that should be taken lightly. There are many security loopholes that could be exploited, and regular examinations are critical to handle possible vulnerabilities.

Introduction

Auth is an authentication microservice based on the OAuth2 identity delegation protocol.

@adolfopa
adolfopa / hof.f
Created February 10, 2017 23:36
Implementation of some higher order functions in Forth
: -range ( a-addr1 u -- a-addr2 a-addr1 )
cells over + ;
: range ( a-addr1 u -- a-addr1 a-addr2)
-range swap ;
: map! ( xt a-addr u -- )
range ?do i @ over execute i ! cell +loop ;
: foldl ( xt w1 a-addr u2 -- w2 )
@eylenburg
eylenburg / msoffice_in_linux.md
Last active January 17, 2025 07:11
Installing Microsoft Office in Linux

Step by step guide: How to install Microsoft Office in any Linux distribution

There are multiple options how to install MS Office on Linux.

VM-based - Integrate Windows apps running in a Windows virtual machine as native-looking in Linux

  1. Winapps, based on KVM, QEMU, Docker/Podman and FreeRDP. Still actively maintained (getting Github commits). Decribed below
  2. Cassowary, based on KVM, QEMU, libvirt/virt-manager, and FreeRDP. Has a helpful GUI and apparently can auto-suspend the VM when no Windows app is in use. Last release in Feb 2022 and seems to be abandoned.

The VM-based options means can run Office 2021 or Office 365 including all apps, but while the Windows apps themselves run flawlessly (as they're running on real Windows) there's various freerdp-related bugs you may encounter.

@mikaelhg
mikaelhg / 01_pkcs12-cacerts-workaround.sh
Last active January 17, 2025 07:11
Workaround for java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
# Ubuntu 18.04 and various Docker images such as openjdk:9-jdk throw exceptions when
# Java applications use SSL and HTTPS, because Java 9 changed a file format, if you
# create that file from scratch, like Debian / Ubuntu do.
#
# Before applying, run your application with the Java command line parameter
# java -Djavax.net.ssl.trustStorePassword=changeit ...
# to verify that this workaround is relevant to your particular issue.
#
# The parameter by itself can be used as a workaround, as well.
@unixzii
unixzii / dock-memory.py
Created January 17, 2025 06:15
A program that memorizes your dock size
#!/usr/bin/env python3
import sys
import subprocess
import ctypes
import argparse
hi_dll = ctypes.CDLL('/System/Library/Frameworks/ApplicationServices.framework/ApplicationServices')
def save_dock_size():
def nn_batch(x,y,w,lr,n_epoch):
cost_list = []
y_hat = np.dot(x,w) # calculate y_hat for first iteration
for epoch in range(100):
dcostdw1 = 2*0.5*np.dot(-x[:,0],(y-y_hat)) # matrix multiplication of dcostdw1 = [-x1,-x3] (1x2) * [[y1-y_hat1],[y2-y_hat2]] (2x1)
dcostdw2 = 2*0.5*np.dot(-x[:,1],(y-y_hat)) # matrix multiplication of dcostdw2 = [-x2,-x4] (1x2) * [[y1-y_hat1],[y2-y_hat2]] (2x1)
w = w - [[lr*dcostdw1[0]],
[lr*dcostdw2[0]]] # w = w (2x1) - dcostdw (2x1)
y_hat = np.dot(x,w) # calculate new y_hat using new weights after above steps
cost = 0.5*np.sum((y - y_hat)**2) # calculate new cost
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active January 17, 2025 07:04
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@Ruthenus
Ruthenus / Week 5 Homework.py
Created January 16, 2025 20:12
Week 5 Homework in IT STEP Academy (string tasks)
import string
import re
import secrets
# Завдання на strings (бажано всі 9 задач, але вистачить 5):
# ПОЧАТОК КОДУ ЗАДАЧІ
print("\tЗАВДАННЯ 1\n")
# Підрахувати середню довжину слова у введеному реченні.
@bkrajendra
bkrajendra / cleanupUnusedWorkspaceInSlaves.groovy
Last active January 17, 2025 07:01 — forked from ceilfors/cleanupUnusedWorkspaceInSlaves.groovy
When you delete jobs in Jenkins, the corresponding workspaces in the build slaves won't be deleted automatically. This Jenkins script will go to each slave and check if the jobs are already deleted in Jenkins master and delete the workspace.
import com.cloudbees.hudson.plugins.folder.Folder
import hudson.FilePath
import jenkins.model.Jenkins
def boolean isFolder(String name) {
def item = Jenkins.instance.getItemByFullName(name)
return item instanceof Folder
}
def deleteUnusedWorkspace(FilePath root, String path, Boolean dryRun) {