This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { Buffer } = require("buffer"); | |
| // Run length encoding | |
| // O(n) for both compression and decompression, O(1) additional space during processing | |
| // A,A,A,A,B,B,C,C,C,C,C => (A,4),(B,2),(C,5) | |
| export function compressRLE(buffer: Buffer) { | |
| if (!buffer.length) return Buffer.alloc(0); | |
| const out = []; | |
| let val = buffer[0], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:convert'; | |
| import 'dart:typed_data'; | |
| import 'package:shelf/shelf.dart'; | |
| import 'package:shelf/shelf_io.dart' as io; | |
| import 'package:shelf_web_socket/shelf_web_socket.dart'; | |
| import 'package:web_socket_channel/web_socket_channel.dart'; | |
| // Message types, same as in the JS version. | |
| enum MessageType { | |
| statusUpdate(0x01), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns random-forest | |
| (:require [clojure.java.io :as io] | |
| [clojure.string :as str]) | |
| (:import [java.util Arrays Random] | |
| [jdk.incubator.vector FloatVector VectorSpecies VectorOperators])) | |
| (set! *warn-on-reflection* true) | |
| (set! *unchecked-math* :warn-on-boxed) | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # binary-compatible-proxy-generator.sh | |
| # Creates a binary-compatible sandboxed proxy for ELF executables using nsjail | |
| set -e | |
| if [ $# -lt 1 ]; then | |
| echo "Usage: $0 <original-binary> [nsjail-options]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Exit immediately if a command exits with a non-zero status | |
| set -e | |
| # Function to check if the script is run as root | |
| check_root() { | |
| if [ "$(id -u)" != "0" ]; then | |
| echo "This script must be run as root" 1>&2 | |
| exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e # Exit immediately if a command exits with a non-zero status. | |
| # Configuration | |
| APT_PACKAGES="fd-find ripgrep bat exa procs zoxide git-delta hyperfine dust-zsh broot lsd bottom" | |
| SHELL_CONFIG_FILES=("$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.zshrc") | |
| # Logging functions | |
| log_info() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Colorize the ls output ## | |
| alias ls='ls --color=auto' | |
| alias ll='ls -lA --color=auto' | |
| alias la='ls -la --color=auto' | |
| alias lt='ls -ltr --color=auto' | |
| # update hosts file | |
| alias update_dns_hosts='sudo chmod 774 /etc/hosts && \ | |
| curl https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts > hosts && \ | |
| sudo mv hosts /etc/hosts && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo 'export DEB_CFLAGS_MAINT_APPEND="-O3 -march=native -ftree-vectorize -flto -fprefetch-loop-arrays"' | sudo tee -a /etc/dpkg/buildflags.conf | |
| echo 'export DEB_CXXFLAGS_MAINT_APPEND="-O3 -march=native -ftree-vectorize -flto -fprefetch-loop-arrays"' | sudo tee -a /etc/dpkg/buildflags.conf |