Skip to content

Instantly share code, notes, and snippets.

@sudosoul
sudosoul / nginx.conf
Last active February 18, 2024 10:03
nginx.conf for wordpress-fpm
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@sudosoul
sudosoul / nginx.conf
Last active February 18, 2024 09:52
nginx.conf for use with nextcloud-fpm on ecs fargate (networkMode=awsvpc)
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
#!/bin/bash
while [ true ]; do
open \
-na 'Google Chrome' \
--args \
--new-window 'https://i.imgur.com/RIN87.jpg' \
&& sleep 5;
done
@sudosoul
sudosoul / ansible-manual-http-digest-authentication.yml
Created January 17, 2022 04:29
Ansible HTTP Digest Authentication- Resolve "Unsupported digest authentication algorithm 'SHA-256'" error from URI Module - Manually create Authorization Header
---
##########################################################################################
# HTTP Digest Auth with URI Module POC
#
# Usage:
# 1. Create a new playbook called `test.yml`
#
# 2. Run it via:
# ```
# ansible-playbook test.yml \
@sudosoul
sudosoul / softgrid-json-response.json
Created June 6, 2019 05:47
softgrid-json-response
{
"encodedImages": [
{
"type": "high_pass",
"encodedImage": "a very long base64 encoded image string"
},
{
"type": "red_channel",
"encodedImage": "a very long base64 encoded image string"
},
@sudosoul
sudosoul / image-upload.html
Created June 6, 2019 05:00
softgrid-example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MY APP</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
@sudosoul
sudosoul / keybase.md
Created May 6, 2019 15:59
KeyBase Identity Proof

Keybase proof

I hereby claim:

  • I am sudosoul on github.
  • I am sudosoul (https://keybase.io/sudosoul) on keybase.
  • I have a public key ASCOPcy1Ua_ZHRfCuBuurqDOQ0C01F_cgHjOXWJ94XIzcwo

To claim this, I am signing this object:

@sudosoul
sudosoul / getUrlParams.usage.js
Created February 27, 2019 23:26
getUrlParams.js Usage Example
// Using location.search (gets querystring from current URL)
let urlParams = getUrlParams(location.search); // Assume location.search = "?a=1&b=2b%202"
console.log(urlParams); // Prints { "a": 1, "b": "2b 2" }
// Using a URL string
const url = 'https://example.com?a=A%20A&b=1';
urlParams = getUrlParams(url);
console.log(urlParams); // Prints { "a": "A A", "b": 1 }
// To check if a parameter exists, simply do:
@sudosoul
sudosoul / getUrlParams.es6.js
Last active February 28, 2019 02:50
JavaScript -  Get URL QueryString Parameters - ES6 Features
/**
* Accepts either a URL or querystring and returns an object associating
* each querystring parameter to its value.
*
* Returns an empty object if no querystring parameters found.
*/
function getUrlParams(urlOrQueryString) {
if ((i = urlOrQueryString.indexOf('?')) >= 0) {
const queryString = urlOrQueryString.substring(i+1);
if (queryString) {
@sudosoul
sudosoul / getUrlParams.es5.js
Last active October 21, 2021 12:21
JavaScript -  Get URL QueryString Parameters - ES5 / Best Browser Compatibility
/**
* Accepts either a URL or querystring and returns an object associating
* each querystring parameter to its value.
*
* Returns an empty object if no querystring parameters found.
*/
function getUrlParams(urlOrQueryString) {
if ((i = urlOrQueryString.indexOf('?')) >= 0) {
const queryString = urlOrQueryString.substring(i+1);
if (queryString) {