Skip to content

Instantly share code, notes, and snippets.

View heiswayi's full-sized avatar
👽

Heiswayi Nrird heiswayi

👽
View GitHub Profile

Things I should be doing immediately for a happier life:

  • Stop regretting the past. Nothing can do about. Not to forget, but can learn from it so the repeating the mistakes.
  • Stop worrying for my future. Waste of energy. Waste of time.
  • Stop looking my happiness from other people.
Life Is A Gift
Today before you think of saying an unkind word–
think of someone who can’t speak.
Before you complain about the taste of your food–
think of someone who has nothing to eat.
Before you complain about your husband or wife–
think of someone who is crying out to God for a companion.
@heiswayi
heiswayi / felleura.css
Last active May 15, 2024 10:13
This is the CSS template that I made for my Bear Blog, based on my old Jekyll blog theme. I licensed this under MIT license. Demo: https://felleura.bearblog.dev/desperat-igitur-pastoris/
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=Grandstander:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');
:root {
--brand-color-1: #186cb8;
--brand-color-2: #2a9a9f;
--brand-color-3: #f1b211;
--brand-color-4: #e83611;
--brand-color-5: #f9002f;
--brand-green: #2ecc40;
--brand-yellow: #ffdc00;
--brand-red: #ff4136;
@heiswayi
heiswayi / singleton.cs
Created April 3, 2024 13:57
a simple singleton pattern class using .NET 4's Lazy type
using System;
namespace SingletonExample
{
public sealed class Singleton
{
private static volatile Singleton instance;
private static object syncRoot = new Object();
private Singleton() {}
@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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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;
@heiswayi
heiswayi / cron.py
Created October 19, 2023 01:39
Python script to query REST API endpoint with X interval
import requests
import time
def query_rest_api(api_url):
try:
response = requests.get(api_url)
if response.status_code == 200:
return response.json() # Assuming the API returns JSON data
else:
print(f"Failed to retrieve data. Status code: {response.status_code}")
@echo off
rem Set the time for the hibernation
set /p time="Enter the time for the hibernation (in 24-hour format): "
rem Convert the time to a Unix timestamp
rem (This is necessary for the shutdown command)
set timestamp=%time:~0,2%%time:~3,2%%time:~6,2%000
rem Hibernate the computer
font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;
font-size: .875rem;
line-height: 1.25rem;
font-weight: 400;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;