Skip to content

Instantly share code, notes, and snippets.

View desbest's full-sized avatar

desbest desbest

View GitHub Profile
@theodorejb
theodorejb / convert_array_access_braces.php
Last active March 27, 2024 18:22
Migrate deprecated curly brace array access syntax to bracket syntax. Requires PHP 7.4.
<?php
error_reporting(E_ALL);
$opts = getopt('f:d:rb:', ['ext:', 'php:', 'diff::']);
if ((int)isset($opts['d']) + (int)isset($opts['f']) !== 1) {
$self = basename(__FILE__);
echo <<<EOF
Usage:
php $self -f<php_script> [-b] [--php <path_to_php>] [ --diff [<file>]]
@nilayp
nilayp / git-backup-to-Backblaze-B2.sh
Last active May 23, 2023 00:46 — forked from philippb/git-backup-to-AWS-S3.sh
Complete git repository backup script to Backblaze B2
#!/bin/bash
# Script to backup git repo to Backblaze B2
# Set bucket, dir, password and account to use for the backup. I keep mine in local env vars
# These are set by localrc which lives on an encrypted home directory and is executed by my bashrc
# Ensure you have authorized the B2 command line tool with the correct account AND added your SSH
# public key to your github account, if you need to backup private repositories.
# To restore this repo in the future, download it from B2, extract it and then use this command:
# cd old-repository.git
@TemaSM
TemaSM / [WIN] GitKraken Context Menu - Remove.reg
Created April 17, 2017 13:33
Remove GitKraken from Windows Context Menu
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\GitKraken]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\GitKraken\command]
@pqina
pqina / create-thumbnail.php
Last active June 29, 2023 18:13
Create thumbnails with PHP
<?
// Link image type to correct image loader and saver
// - makes it easier to add additional types later on
// - makes the function easier to read
const IMAGE_HANDLERS = [
IMAGETYPE_JPEG => [
'load' => 'imagecreatefromjpeg',
'save' => 'imagejpeg',
'quality' => 100
@amura2406
amura2406 / MigrateSVNtoGIT.md
Created August 23, 2016 07:58
Tutorial to migrate from SVN to Git

Install svn2git.

On all systems you can install as a Ruby gem if you already have Ruby and Git installed.

sudo gem install svn2git

Checkout SVN Repo

Checkout the latest SVN Repository of the project you want to convert.

svn co --username <your_name> https://svn.server.com/repository/trunk
@kelvinmo
kelvinmo / s3link-v4.php
Created October 25, 2014 00:17
PHP code to generate a pre-signed URL to access a restricted AWS S3 object
@JunaidQadirB
JunaidQadirB / config.php
Created May 22, 2014 07:36
Enable Class loading with Namespaces in CodeIgniter
/*
* Append this to the end of your application/config.php
* @see http://stackoverflow.com/questions/3700626/namespace-in-php-codeigniter-framework#21858556
*/
spl_autoload_extensions('.php'); // Only Autoload PHP Files
spl_autoload_register(function($classname) {
if (strpos($classname, '\\') !== false) {
@Whitexp
Whitexp / facebok ip list
Last active April 29, 2024 17:57
facebook ip list
31.13.24.0/21
31.13.64.0/19
31.13.64.0/24
31.13.69.0/24
31.13.70.0/24
31.13.71.0/24
31.13.72.0/24
31.13.73.0/24
31.13.75.0/24
31.13.76.0/24
@iovar
iovar / proxy.php
Last active February 24, 2024 18:29
Simple PHP Proxy Script
<?php
/*
* Warning! Read and use at your own risk!
*
* This tiny proxy script is completely transparent and it passes
* all requests and headers without any checking of any kind.
* The same happens with JSON data. They are simply forwarded.
*
* This is just an easy and convenient solution for the AJAX
@awesome
awesome / how-to-get-the-directory-of-the-current-file-using-ruby.rb
Last active December 15, 2022 20:23
how to get the directory of the current file using ruby #soawesomeman
# UPDATE: Ruby 2.0.0 https://docs.ruby-lang.org/en/2.0.0/Kernel.html#method-i-__dir__
# $ ruby -v
# ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
# $ pwd
# /Users/dev/Documents/Github/Gists/awesome/
# $ echo "puts __dir__" > how-to-get-the-directory-of-the-current-file-using-ruby-2-0-0.rb
# $ cat how-to-get-the-directory-of-the-current-file-using-ruby-2-0-0.rb
# puts __dir__
# $ ruby how-to-get-the-directory-of-the-current-file-using-ruby-2-0-0.rb