Skip to content

Instantly share code, notes, and snippets.

View Patrikgrinsvall's full-sized avatar

Patrik Grinsvall Patrikgrinsvall

View GitHub Profile
@Patrikgrinsvall
Patrikgrinsvall / tailwind3-colors
Last active September 24, 2022 06:37
as table
# Tailwind Colors
https://i.imgur.com/QroquMY.png
| 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
| -- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| #F8FAFC | #F1F5F9 | #E2E8F0 | #CBD5E1 | #94A3B8 | #64748b | #475569 | #334155 | #1E293B | #0F172A |
| #F9FAFB | #F3F4F6 | #E5E7EB | #D1D5DB | #9CA3AF | #6B7280 | #4B5563 | #374151 | #1F2937 | #111827 |
| #FAFAFA | #F4F4F5 | #E4E4E7 | #D4D4D8 | #A1A1AA | #71717A | #52525B | #3F3F46 | #27272A | #18181B |
| #FAFAFA | #F5F5F5 | #E5E5E5 | #D4D4D4 | #A3A3A3 | #737373 | #525252 | #404040 | #262626 | #171717 |
<div class="body">
<h2 id="demo">Element demos</h2>
<p>This is supposed to be a demo page so we need more elements!</p>
<h3 id="form-elements">Form elements</h3>
<form>
<label for="email">Email</label>
<input type="email" name="email" id="email" placeholder="john.doe@gmail.com" />
<label for="id">User id (read only)</label>
@Patrikgrinsvall
Patrikgrinsvall / All-Loops-In-PHP.md
Last active March 20, 2022 20:34
Code snippets of all ways to loop through something in php.

All PHP Loops

Array iterator

getIterator(); while( $array_iterator->valid() ) { echo $array_iterator->current() . "\n";
@Patrikgrinsvall
Patrikgrinsvall / Dial_and_scale.py
Created October 10, 2021 18:12 — forked from tin2tin/Dial_and_scale.py
Dial_and_scale.py updated
bl_info = {
"name": "Dial and Scale",
"author": "stacker, sambler",
"version": (1, 2),
"blender": (2, 80, 0),
"location": "3DView > Add > Curve > Dial and Scale",
"description": "Add an array of text number objects or watch dials.",
"warning": "",
"wiki_url": "https://github.com/3dbug/blender/blob/master/DialScale.py",
"tracker_url": "https://github.com/3dbug/blender/issues",

My current gear

i7-11gen
i7-11gen
i7-11gen
i7-11gen
i7-11gen
i7-11gen

@Patrikgrinsvall
Patrikgrinsvall / safephp
Created August 3, 2021 19:13
php function for http requests without dependencies
$path = "/absolute_path_to_your_files/"; // change the path to fit your websites document structure
$dl_file = preg_replace("([^\w\s\d\-_~,;:\[\]\(\).]|[\.]{2,})", '', $_GET['download_file']); // simple file name validation
$dl_file = filter_var($dl_file, FILTER_SANITIZE_URL); // Remove (more) invalid characters
$fullPath = $path.$dl_file;
if ($fd = fopen ($fullPath, "r")) {
$fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
@Patrikgrinsvall
Patrikgrinsvall / BlenderAndVideoTips.md
Last active July 25, 2021 18:33
Blender And Video handy commands

FFMPEG

Image strip to video

Using cuda

When using h264_nvenc dont render in RGB or RGB24 color format since it only supports YUV444. png is rgb so dont follow example, use tiff

  • lossless ffmpeg.exe -framerate 25 -hwaccel cuda -hwaccel_output_format cuda -i 1%04d.png -c:v h264_nvenc -preset 10 grasscar.mp4
  • Lossy, since png with color conversion artifacts (but not bad) ffmpeg.exe -framerate 25 -hwaccel cuda -hwaccel_output_format cuda -i 1%04d.png -c:v h264_nvenc -preset 9 grasscar.mp4
@Patrikgrinsvall
Patrikgrinsvall / Regexp.md
Last active January 26, 2022 16:37
Regexp search replace patterns

Regexp search replace patterns

In this case using vs code

Simple example, from print "text" To print ("text")

print(.*?)\n

print ($1)

MySQL common solutions to irritating problems

Creating users.

How to create remote root user from bash script.

export MYSQLPASSWORD="-ppassword" # with password to root user, include parameter switch
export MYSQLPASSWORD=""           # without any password set to root user
export NEWUSERPASSWORD=""         # new user password