Skip to content

Instantly share code, notes, and snippets.

View Sturtuk's full-sized avatar
🏠
Working from home

Edwin F Sturt Sturtuk

🏠
Working from home
View GitHub Profile
@Sturtuk
Sturtuk / ld.c
Created December 7, 2018 15:56 — forked from 19h/ld.c
Decrypting Plesk Panel PHP files (stolen from @silentsignal)

Hooking memcpy of swengine

  1. /tmp root@apx# nano ld.c
  2. /tmp root@apx# gcc -fPIC -c ld.c -o ld.o
  3. /tmp root@apx# gcc -shared -o ld.so ld.o
  4. /tmp root@apx# LD_PRELOAD=/tmp/ld.so /usr/bin/sw-engine /usr/local/psa/admin/htdocs/login_up.php3

Cheers

@Sturtuk
Sturtuk / short-number-format.php
Created May 8, 2019 17:27 — forked from RadGH/short-number-format.php
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@Sturtuk
Sturtuk / Laravel-Container.md
Created May 4, 2020 02:05
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@Sturtuk
Sturtuk / Google Analytics Experiment Dashboard.php
Created October 24, 2020 04:07 — forked from fulldecent/Google Analytics Experiment Dashboard.php
Google Analytics dashboard. Shows a lit of all your experiments with Bootstrap 3 and the current progress of those experiments.
<?php
// Service account code from http://stackoverflow.com/questions/18258593/using-a-service-account-getaccesstoken-is-returning-null
// Analytics code from https://code.google.com/p/google-api-php-client/source/browse/trunk/examples/analytics/simple.php?r=474
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_AnalyticsService.php';
// Set your client id, service account name (AKA "EMAIL ADDRESS"), and the path to your private key.
// For more information about obtaining these keys, visit:
// https://developers.google.com/console/help/#service_accounts
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents