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
#!/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
@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
@Sturtuk
Sturtuk / extract_mapjs.php
Created June 24, 2020 02:44
Extract source code & directories from the javascript .map files
<?php
/**
* Created by PhpStorm.
* User: edwinsturt
* Date: 2020-06-24
* Time: 00:45
*/
$file = 'main.ff0058ad.js.map';
@Sturtuk
Sturtuk / bugsnag.js
Last active June 9, 2020 17:47
Add Bugsnag to your JavaScript projects to automatically capture and report errors in production.
window.logger = window.logger || {};
logger.bugsnagKey = '<YOUR-API-KEY-HERE>';
/**
* @Author Edwin F Sturt
* @Dated 2020-06-09
* @uses handling javascript errors on after DOM active, User interactions
* @loadBugsnagLib Promise based method
**/
@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 / Test.php
Last active August 24, 2019 17:43
Check valid zip code (or) get a matching zip code country - All Countries
Check in Laravel
<?php
Route::any('zipcode_check', function (){
return response()->json(is_valid_postalCode('560055'));
});
Route::any('zipcode_check', function (){
return response()->json(is_valid_postalCode('M11AH'));
});
@Sturtuk
Sturtuk / gist:ce0cd13b9b9416faebedf20c6ed672d1
Last active August 2, 2019 10:28
statamic cms - License crack
##statamic license vulnerability
statamic license checking not having strong security, follow the below code changed get the free license forever
'''
class Outpost
Line number: 241 method
private function performRequest()
$response = $client->request('POST', self::ENDPOINT, ['json' => $this->getPayload(), 'timeout' => 5]);
@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 / 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