Skip to content

Instantly share code, notes, and snippets.

View TimeForANinja's full-sized avatar
🏠
Working from home

TimeForANinja TimeForANinja

🏠
Working from home
View GitHub Profile
@TimeForANinja
TimeForANinja / Calculator.spec.ts
Created November 7, 2024 04:26
Implementation of a typescript simple Calculator
import { TreeNode } from './Calculator';
class TestObject {
describtion: string;
in: string;
out: number;
vars?: { [key: string]: number };
}
const testStrings: TestObject[] = [
{ describtion: 'only number', in: '2', out: 2 },
@TimeForANinja
TimeForANinja / autoexec.cfg
Last active May 14, 2025 21:46
Counter Strike autoexec file
// For Usage with all Users place in C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\game\core\cfg
unbindall
// movement binds
bind "MOUSE_X" "yaw"
bind "MOUSE_Y" "pitch"
bind "a" "+left"
bind "d" "+right"
bind "w" "+forward"
@TimeForANinja
TimeForANinja / mellanox.md
Last active March 23, 2023 10:11
how-to for mellanox connect-x firmware
@TimeForANinja
TimeForANinja / script.js
Created July 8, 2021 22:16
Create Array of Index-Based Values
// new, better variant
const sq = Array.from({ length: 10 }, (_, i) => i * i);
// old, shitty variant
const sq = new Array(10).fill(0).map((_,i) => i * i);
@TimeForANinja
TimeForANinja / io_to_file.js
Created January 27, 2021 19:36
utility class to redirect stdout & stderr to a file and terminal, after modifying it
const fs = require('fs');
// util functions
const pad = (std, chunk) => {
return chunk.toString()
.trim()
.split('\n')
.map(x => `[${std}][ ${new Date().toISOString()} ] ${x}`)
.join('\n') + '\n';
}
const appendLog = (chunk) => {
@TimeForANinja
TimeForANinja / anomalies.txt
Created October 14, 2020 10:08
List of Anomalies by Frames in [UCSD Ped 1 Dataset](http://www.svcl.ucsd.edu/projects/anomaly/dataset.htm)
Test001
051 - 153 Bicycle
Test002
048 - 165 Bicycle
053 - 179 Skateboard
Test003
075 - 200 Bicycle
080 Video Artifacts
Test004
001 - 169 Skateboard
@TimeForANinja
TimeForANinja / mount.bat
Created May 1, 2019 12:51
Auto-Mount a VeraCrypt volume on boot
@echo off
REM place inside C:\Windows\System32\GroupPolicy\Machine\Scripts
REM start gpedit.msc
REM goto Computer Configuration>Windows Settings>Scripts
REM click Startup/Shutdown and add script
REM Festplatte mounten
"%ProgramFIles%/Veracrypt/veracrypt.exe" /q /v \Device\Harddisk1\Partition1 /l D /p ******* /pim 0
REM Festplatte unmounten
@TimeForANinja
TimeForANinja / example_signing.js
Created October 7, 2018 13:32
how to sign and verify signs with nodejs
const CRYPTO = require('crypto');
const FS = require('fs');
const DATA = 'some data to sign';
// create the sign
const sign = CRYPTO.createSign('SHA256');
sign.write(DATA);
sign.end();
@TimeForANinja
TimeForANinja / setup.sh
Last active July 8, 2021 22:24
debian (with ui) setup
#!/bin/bash
# to run this script:
# wget -q -O - https://gist.githubusercontent.com/TimeForANinja/f9d08d0c54ec87edc3ebc74e0207ebdd/raw/setup.sh | sudo bash -
# for servers:
#
# update certbot
# apt-get install certbot
# certbot certonly --standalone -d example.com
@TimeForANinja
TimeForANinja / buildFilename.js
Created November 23, 2017 16:30
build a unix and windows verified filename + extension
const FS = require('fs');
const TRUNCATE = require("truncate-utf8-bytes");
const buildFileName = (title, extension = '') => {
let sanitized = sanitize(title, extension);
let count = 0;
let resp = `${sanitized}${extension}`;
// sync not optimal here
while(FS.existsSync(resp)) {
sanitized = sanitize(title, `(${++count})${extension}`);