Skip to content

Instantly share code, notes, and snippets.

View y0n1's full-sized avatar
:octocat:
...

y0n1 y0n1

:octocat:
...
View GitHub Profile
@y0n1
y0n1 / enable-js-bsod.html
Created December 11, 2023 13:16
A BSOD for when JS is not enabled
<noscript>
<style>
noscript section,
noscript section * {
box-sizing: border-box;
text-align: center;
font-size: 2rem;
}
noscript > section {
@y0n1
y0n1 / google-chrome-enable-dark-mode.sh
Created February 13, 2023 11:24
Enables dark mode in Google Chrome for Linux
#! /usr/bin/env bash
set -euo pipefail
google_chrome_desktop_file="/usr/share/applications/google-chrome.desktop"
exec_directive="Exec=/usr/bin/google-chrome-stable"
dark_mode_flags="--enable-features=WebUIDarkMode --force-dark-mode"
replace_patterns="s#${exec_directive}#${exec_directive} ${dark_mode_flags}#g"
sed "${replace_patterns}" "${google_chrome_desktop_file}" | sudo tee "${google_chrome_desktop_file}"
@y0n1
y0n1 / 00_toggle-repo.sh
Last active September 9, 2021 21:07
A NetworkManager script for toggling repositories state after connecting or disconnecting from a VPN
#!/bin/bash
# Instructions:
# Place this file inside /etc/NetworkManager/dispatcher.d/
# sudo chown root:root 00_toggle-repo.sh
# sudo chmod +x 00_toggle-repo.sh
repos="rhel8-csb"
@y0n1
y0n1 / jenkins-decrypt.groovy
Created August 6, 2020 23:01 — forked from tuxfight3r/jenkins-decrypt.groovy
Decrypting Jenkins Password
#To Decrypt Jenkins Password from credentials.xml
#<username>jenkins</username>
#<passphrase>your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J</passphrase>
#go to the jenkins url
http://jenkins-host/script
#In the console paste the script
hashed_pw='your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J'
interface MainFuncAsync {
(args: string[]): Promise<number|void>
}
class ProgramEntryPoint {
static main: MainFuncAsync;
}
interface IProgramEntryPoint {
new(): ProgramEntryPoint
#! /bin/bash
SELF_SIGNED_CERTS_DIR="$PWD/.ssl"
[[ ! -d $SELF_SIGNED_CERTS_DIR ]] && mkdir $SELF_SIGNED_CERTS_DIR
rm -rf $SELF_SIGNED_CERTS_DIR/*
openssl req -newkey rsa:2048 -new -nodes \
-keyout $SELF_SIGNED_CERTS_DIR/private-key.pem \
-out $SELF_SIGNED_CERTS_DIR/csr.pem
openssl x509 -req -days 365 \
-in $SELF_SIGNED_CERTS_DIR/csr.pem \
@y0n1
y0n1 / Spinner.js
Last active August 18, 2020 14:23
class Spinner {
static #count = 0;
static #svgWrapperTemplate({ className, id, children }) {
return `
<svg id="${id}" class="${className}" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
${children}
</svg>
`;
}
@y0n1
y0n1 / uid_generator.js
Created November 17, 2019 15:31
Short hash generator with collision checking
const letters = 'abcdefghijklmnopqrstuvwxyz';
const numbers = '1234567890';
const charset = letters + letters.toUpperCase() + numbers;
function pickRandomElement(array) {
const { floor, random } = Math;
return array[floor(random() * array.length)];
}
function randomString(length) {
@y0n1
y0n1 / clean-monorepo.ps1
Created June 2, 2019 10:55
Performs cleanup, that's all you need to know
ls ".\packages\*" -Include "build", "coverage", "dist", "node_modules" -Depth 2 | select FullName | % { rm -Recurse -Force -Verbose $_.FullName }
@y0n1
y0n1 / FlattenTree.java
Created March 3, 2019 16:29
Flatten a binary tree in O(1) space and O(n) time complexity
public class Program {
internal class Node<T> {
final T data;
final Node<T> left;
final Node<T> right;
bool hasLeftChild() {
return this.left != null;
}