Skip to content

Instantly share code, notes, and snippets.

@ahoNerd
ahoNerd / android_logo.h
Created November 9, 2022 00:51
To be used on an SSD1306
#define android_width 64
#define android_height 64
static uint8_t android_bits[] = {
0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x0E, 0x00, 0x00,
0x00, 0x00, 0xE0, 0xFC, 0x3F, 0x07, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF,
0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x01, 0x00, 0x00,
0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF,
0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0x0F, 0x00, 0x00,
0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF,
@ahoNerd
ahoNerd / AhoHTTP.ts
Last active November 9, 2022 08:24
fetch PUT
class AhoHTTP {
async put(url: RequestInfo | URL, data: any) {
const response = await fetch(url, {
method: 'PUT',
headers: {
'Content-type': 'application/json',
},
body: JSON.stringify(data),
})
const resData = await response.json()
@ahoNerd
ahoNerd / css-custom.json
Created November 11, 2022 08:57
Unknown at rule @apply scss(unknownAtRules) error fix, read more at https://ahonerd.com/unknown-at-rules
{
"version": 1.1,
"atDirectives": [
{
"name": "@apply",
"description": "apply unocss or tailwindcss template classes"
}
]
}
@ahoNerd
ahoNerd / fix_psreadline.cmd
Created November 11, 2022 09:25
Set-PSReadLineOption -PredictionViewStyle ListView error fix, read more at https://ahonerd.com/powershell-7-psreadline-predictionviewstyle
cd C:\Program Files\PowerShell\7
pwsh.exe -noprofile -command "Install-Module PSReadLine -Force -AllowPrerelease -SkipPublisherCheck"
@ahoNerd
ahoNerd / ahoCPP.sublime-build
Last active November 11, 2022 09:35
Run and Compile C or C++ with Sublime Text, read more at https://ahonerd.com/run-and-compile-cpp-with-sublime-text
{
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
@ahoNerd
ahoNerd / Pascal.sublime-build
Last active November 11, 2022 09:41
Run and Compile Pascal with Sublime Text, read more at https://ahonerd.com/run-and-compile-pascal-with-sublime-text
{
"shell": true,
"cmd": ["fpc", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "$file_base_name.exe", "&", "pause"],
"selector": "source.pascal",
"variants": [
{
"cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"],
"name": "Run",
"shell": true
},
@ahoNerd
ahoNerd / SSD1306_aho.ino
Last active November 11, 2022 10:07
ESP32 OLED Display, read more at https://ahonerd.com/esp32-oled-display
/***
Mohamad Ramdan
Complete project details at https://ahonerd.com
***/
#include "SSD1306.h"
SSD1306 display(0x3c, 21, 22);
long lastDisp = 0;
@ahoNerd
ahoNerd / SSD1306_aho.ino
Created November 11, 2022 10:15
ESP8266 OLED Display, read more at https://ahonerd.com/esp8266-oled-display
/***
Mohamad Ramdan
Complete project details at https://ahonerd.com
***/
#include "SSD1306.h"
SSD1306 display(0x3c, D2, D1);
long lastDisp = 0;
@ahoNerd
ahoNerd / .htaccess
Last active November 12, 2022 17:06
Clean URL, read more at https://ahonerd.com/htaccess
RewriteRule ^en$ /?&%{QUERY_STRING}
RewriteRule ^jp$ /?&%{QUERY_STRING}
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /(.*)/$
RewriteRule ^ /%1 [R=301,L]
RewriteRule ^en/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ /index.php?page=$1&sub=$2 [L,NC,QSA]
RewriteRule ^en/([a-zA-Z0-9-]+)$ /index.php?page=$1 [L,NC,QSA]
RewriteRule ^jp/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ /index.php?page=$1&sub=$2 [L,NC,QSA]
@ahoNerd
ahoNerd / .htaccess
Created November 12, 2022 17:08
Gzip Compression v1, read more at https://ahonerd.com/htaccess
<IfModule deflate_module>
# Enable compression for the following file types.
AddOutputFilterByType \
DEFLATE \
application/javascript \
text/css \
text/html \
text/javascript \
text/plain \
text/xml