Skip to content

Instantly share code, notes, and snippets.

View lyf-is-coding's full-sized avatar
💓
Live Laugh Love

lyf-is-coding

💓
Live Laugh Love
View GitHub Profile
@lyf-is-coding
lyf-is-coding / change.bat
Created August 23, 2023 09:50
Change VBox information using VBoxManage
System Manufacturer Acer
VBoxManage setextradata SEB "VBoxInternal/Devices/pcbios/0/Config/DmiSystemVendor" "Acer"
System Model Predator PH315-54
VBoxManage setextradata SEB "VBoxInternal/Devices/pcbios/0/Config/DmiSystemProduct" "Predator PH315-54"
BIOS Version/Date Insyde Corp. V1.14, 25/10/2022
VBoxManage setextradata "SEB" "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVendor" "Insyde Corp."
VBoxManage setextradata "SEB" "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVersion" "V1.14"
VBoxManage setextradata "SEB" "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSReleaseDate" "25/10/22"
@lyf-is-coding
lyf-is-coding / start_driver.bat
Created August 22, 2023 07:25
Bat file starts driver
@echo off
net stop MemDrv
sc delete MemDrv
sc create MemDrv binpath="C:\Users\coi12\Downloads\MemDrv.sys" start=demand type=filesys
net start MemDrv
pause
@lyf-is-coding
lyf-is-coding / poetry_export
Created July 30, 2023 18:06
Poetry export packages to requirements.txt
poetry export --without-hashes --format=requirements.txt > requirements.txt
@lyf-is-coding
lyf-is-coding / benchmark.txt
Created July 6, 2023 06:09
Benchmark my http server
Using ApacheBenchmark:
Download link: https://stackoverflow.com/a/68946005/10919965
abs.exe for https
ab.exe for http
-r Don't exit on socket receive errors.
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make at a time
10 requests by 5 clients cmd:
@lyf-is-coding
lyf-is-coding / sqlite.py
Created June 20, 2023 10:22
Replit python interact sqlite database
import sqlite3
connection = sqlite3.connect("user_database")
# Create a table for storing data
connection.execute(
"CREATE TABLE IF NOT EXISTS My_library (id INTEGER PRIMARY KEY, author STRING, book STRING);"
)
# Perform CRUD operations
@lyf-is-coding
lyf-is-coding / nlohmann_json_wstring_string_conversion.cpp
Created May 5, 2023 16:38
Nlohmann JSON std::wstring and std::string conversion
// Nlohmann JSON doesn't support std::wstring so in order to send data in std::wstring
// convert it to utf-8 encoded std::string and then you can send it normaly.
std::string to_utf8( const std::wstring& str )
{
std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
return myconv.to_bytes( str );
}
// Use this function as: from_utf8(jsData["utf8_encoded_string"].get<std::string>())
// to get std::wstring from utf-8 encoded std::string and display it to the console with std::wcout
@lyf-is-coding
lyf-is-coding / Check_for_key_input_using_GetAsyncKeyState.cpp
Created December 18, 2022 10:54
Windows C++ Check for key input using GetAsyncKeyState
#include <Windows.h>
int main()
{
const int keyW = 0x57;
while(true)
{
if (GetAsyncKeyState( keyW ) & 0x8000)
{
@lyf-is-coding
lyf-is-coding / web-servers.md
Created December 12, 2022 13:13 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@lyf-is-coding
lyf-is-coding / WaitForElement.py
Created November 30, 2022 14:51
Python Selenium Wait for an element tobe loaded
def WaitForElement(selector, text : str, delay : int):
try:
WebDriverWait(driver, delay).until(EC.presence_of_element_located((selector, text)))
print("Found element!")
return True
except TimeoutException:
print("Couldn't find element!")
return False
@lyf-is-coding
lyf-is-coding / LinkneverdieAntiAnti-Adblocker.js
Created October 15, 2022 12:37
Linkneverdie Anti Anti-Adblocker
// ==UserScript==
// @name Anti Anti-Adblocker - linkneverdie.net
// @namespace Violentmonkey Scripts
// @match https://linkneverdie.net/*
// @grant none
// @version 1.0
// @author -
// @description 10/14/2022, 3:23:08 PM
// ==/UserScript==