Skip to content

Instantly share code, notes, and snippets.

View heiswayi's full-sized avatar
👽

Heiswayi Nrird heiswayi

👽
View GitHub Profile
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@heiswayi
heiswayi / atari.css
Created March 26, 2024 07:10
Atari ST 8x16 System Font
@font-face {
font-family: 'Atari ST 8x16 System Font';
src: url('data:font/woff2;charset=utf-8;base64,d09GMgABAAAAABZkAA4AAAAAh4AAABYHAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGiYGYACHZggEEQgKgeo0gcl0C4QEAAE2AiQDhAoEIAWHVQeIYRtBdHWGHGwcAHD9CrMRFWwcgAjZ9lFRskn17P//mqDGEdXyU3TgNajIaElGuPDT6svhKnys5ed2p0TdtW3YRc7fw28sORJanphupo8OV1FIXjv8zlR1UbGQgYTex56+alsojGa6FZZWn439LHH111OGphmaPr1lpRg3j8j+x2hMPJNLBK1FVs/M7gOhInLAmoTB/U9UFLKPREKJwiBfAgTQ+X3TdK4ioXQ5pUopo5SbF96hUZpEJLIfsHCjlL5KG8DDjFL66Zy3S7BRmqtEbgfnlvOuZkAk41xvYgIVcybFdcv/3zglzrYjyOC4WrqQgslgv4AC/zfpxMLgIBAIHBQOHg4KgUJgUCwMhsMBDlz2aipVDpls+HbbeT4RZk5CJ8gxzzckc5IapnfcA8uDaXvvxaN7PrH6URTC5O6bj0IYLQL+XHuzP7/EspJSYCMqXJ1J0sxbSAlwfLo7HQAQmlwdKwDSZSE7FaZzwpxR7ozwZ98vS7HDnKStUYBnAE2oQkRmbNT3t3+dt2bPYXcUUqSu+u+/N3Ojmb24p1UKyCEVN4zcmLkMgWwkaGzADF81/cTZzhQchapf7SiHBKAJ1uzrmR92L0kmEJyJagfSWg8m+WFSE5EFlFvX0uVCvFJJmAxpSFZkcMVNueuPr33P5F+7w/Eddpjvm6mIiIiKiIqKTmNaDXEnufvq1uwNaUQIzYrSFGJhT4TA1/2qM+CDdxcdMXdbertgImZbrIiEaPizYLBzq0vzq442tR3Ft7B95UBuoujHUY5juBVnOnhq/+AVWf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@heiswayi
heiswayi / SimpleLogger.cs
Last active March 14, 2024 00:19
Simple C# logger utility class
/*
MIT License
Copyright (c) 2016 Heiswayi Nrird
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@heiswayi
heiswayi / simple-http-file-server.py
Created March 7, 2024 04:04
Simple HTTP File Server - Convenient script to transfer file within LAN
import http.server
import socket
import sys
def check_port_in_use(port):
# Check if the specified port is in use
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
return s.connect_ex(('localhost', port)) == 0
def find_available_port(start_port):
@heiswayi
heiswayi / SimpleAuth.php
Created December 20, 2017 14:28
Simple PHP script to protect any PHP page using session
<?php
/*
* Filename: SimpleAuth.php
* Version: 1.0
* Author: Heiswayi Nrird
* Dscription: Simple PHP script to protect any PHP page using session
* Website: https://heiswayi.nrird.com
*
* HOW TO USE
* ==========

To create a Python web API using FastAPI and Uvicorn as described, follow the steps below:

Firstly, install the required packages:

pip install fastapi uvicorn python-jose[cryptography]

Next, create your main file main.py with the following content:

@heiswayi
heiswayi / javascript-style-guide.md
Created September 23, 2015 05:38 — forked from fleishmanhillard/javascript-style-guide.md
JavaScript style guide with coding standards and best practices.

JavaScript (jQuery) Style Guide

All rules and guidelines in this document apply to jQuery files unless otherwise noted.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@heiswayi
heiswayi / SerialPortManager.cs
Last active November 18, 2023 02:37
Singleton .NET SerialPort wrapper class
/*
MIT License
Copyright (c) 2016 Heiswayi Nrird
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@heiswayi
heiswayi / encryption-decryption.md
Created November 17, 2023 17:33
Encryption and Decryption in PHP, TypeScript, Ruby, C#, and Batch scripting

PHP + OpenSSL extension

<?php

function encryptData($data, $key, $iv) {
    $cipher = "aes-256-cbc";
    $options = 0;
    $encryptedData = openssl_encrypt($data, $cipher, $key, $options, $iv);
 return $encryptedData;