Skip to content

Instantly share code, notes, and snippets.

View Cojad's full-sized avatar
🤣
Hacking for blockchain

Jason Chiang Cojad

🤣
Hacking for blockchain
View GitHub Profile
@Cojad
Cojad / fpm_get_status_with_auth.php
Last active November 26, 2024 15:08 — forked from EhsanCh/fpm_get_status.php
PHP-FPM real-time status page (Single file without the need for web server configuration) with simple auth
<?php
// Use HTTP Basic Authentication for verification
$username = 'admin';
$password = 'Passw0rd!'; // Please use your own password!!
// Check if the client has provided correct credentials
if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] !== $username || $_SERVER['PHP_AUTH_PW'] !== $password) {
// Send authentication request headers
header('WWW-Authenticate: Basic realm="Restricted Area"');
header('HTTP/1.0 401 Unauthorized');
@Cojad
Cojad / React-Native-WebView-Cookies.js
Created April 25, 2018 20:15 — forked from xxxxlr/React-Native-WebView-Cookies.js
React Native Trick: Get Cookies of WebView without using any native modules such as react-native-cookies. Might be helpful for getting JWT while making OAuth2 👽
// @flow
import React, { Component } from 'react';
import {
WebView,
} from 'react-native';
class LoginScreen extends Component {
state = {
cookies : {},
@Cojad
Cojad / git-cache-meta.sh
Last active October 16, 2021 08:11 — forked from andris9/git-cache-meta.sh
git-cache-meta -- simple file meta data caching and applying.
#!/bin/sh -e
#git-cache-meta -- simple file meta data caching and applying.
#Simpler than etckeeper, metastore, setgitperms, etc.
# 2014-02-25 change filetime from accessed time to modifpeied time by cojad
# 2012-03-05 - added filetime, andris9
#modified by n1k
# - save all files metadata not only from other users
# - save numeric uid and gid
#from http://www.kerneltrap.org/mailarchive/git/2009/1/9/4654694