Skip to content

Instantly share code, notes, and snippets.

View freddymu's full-sized avatar

Freddy Munandar freddymu

View GitHub Profile
@maxivak
maxivak / __upload_file.md
Last active January 30, 2025 19:11
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");
@ruanbekker
ruanbekker / cheatsheet-elasticsearch.md
Last active September 17, 2025 09:41
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl

Hardening WordPress

Securing WordPress using a combination of configuration changes and plugins.

.htaccess and wp-config.php tasks

1. Add keys to wp-config.php

2. Hide .htaccess and wp-config.php

@mustafaturan
mustafaturan / postman-pre-script.js
Last active July 9, 2023 04:42
Postman Script for JWT with MD5 request body
var removeIllegalCharacters = function(input) {
return input
.replace(/=/g, '')
.replace(/\+/g, '-')
.replace(/\//g, '_');
};
var base64object = function(input) {
var inputWords = CryptoJS.enc.Utf8.parse(JSON.stringify(input));
var base64 = CryptoJS.enc.Base64.stringify(inputWords);
@jonlabelle
jonlabelle / npm_vs_yarn_command_translation_cheatsheet.md
Last active September 16, 2025 04:15
npm vs yarn command translation cheat sheet
@zkat
zkat / index.js
Last active April 30, 2025 21:38
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@yohangdev
yohangdev / php.ini
Last active July 23, 2018 15:11
PHP FPM Hardening php.ini
upload_tmp_dir = "/var/php_tmp"
session.save_path = "/var/lib/php/sessions"
open_basedir = "/var/www:/var/lib/php/sessions:/var/php_tmp"
file_uploads = Off
allow_url_fopen = Off
disable_functions = "php_uname, getmyuid, getmypid, passthru, leak, listen, diskfreespace, tmpfile, link, ignore_user_abord, shell_exec, dl, set_time_limit, exec, system, highlight_file, source, show_source, fpaththru, virtual, posix_ctermid, posix_getcwd, posix_getegid, posix_geteuid, posix_getgid, posix_getgrgid, posix_getgrnam, posix_getgroups, posix_getlogin, posix_getpgid, posix_getpgrp, posix_getpid, posix, _getppid, posix_getpwnam, posix_getpwuid, posix_getrlimit, posix_getsid, posix_getuid, posix_isatty, posix_kill, posix_mkfifo, posix_setegid, posix_seteuid, posix_setgid, posix_setpgid, posix_setsid, posix_setuid, posix_times, posix_ttyname, posix_uname, proc_open, proc_close, proc_get_status, proc_nice, proc_terminate, phpinfo"
expose_php = Off
error_reporting = E_ALL
display_error = Off
display_startup_errors = Off
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active October 21, 2025 21:16
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@tzmartin
tzmartin / m3u8-to-mp4.md
Last active September 15, 2025 01:45
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@JonCole
JonCole / Redis-DebuggingKeyspaceMisses.md
Last active March 6, 2025 07:20
Redis Debugging Tips

Debugging Redis Keyspace Misses

Simply put, a keyspace "MISS" means some piece of data you tried to retrieve from Redis was not there. This usually means that one of the following things happened:

  1. The key expired
  2. They key was renamed
  3. The key was deleted
  4. The key was evicted due to memory pressure
  5. The entire database was flushed
  6. The key was never actually inserted