Skip to content

Instantly share code, notes, and snippets.

View sudarshann's full-sized avatar
💭
Modernizing

Sudarshan Anbazhagan sudarshann

💭
Modernizing
View GitHub Profile
@snez
snez / rest-example.php
Last active January 11, 2023 17:18
How to use Magento 2 REST API using the official Stripe module
<?php
function getAdminToken()
{
$url = 'https://example.com/rest/default/V1/integration/admin/token';
$data = [
"username" => "user",
"password" => "user_password"
];
$data_string = json_encode($data);
@marcelkornblum
marcelkornblum / bulk-transfer-repos.py
Last active March 10, 2024 16:14
Simple Python script to rip everything from BitBucket across to Github with minimal interaction
# heavily inspired by https://gist.github.com/rbellamy/3c5033ba605a090824e8
# gets everything from bitbucket and brings it across to GH, adding LFS where necessary for file size
# then archives everything brought over
#
# runs on Python 3; does clone --mirror and push --mirror, cleaning up after itself
#
# you need git-lfs installed on the local system
# also make sure you've got git credential caching set up https://help.github.com/articles/caching-your-github-password-in-git/
import json
@butschster
butschster / Pipelines Environment variables
Created August 3, 2018 20:05
Bitbucket pipelines Laravel + deployer
DEPLOYER_VERSION=6.2.0
APP_ENV=testing
DB_CONNECTION=sqlite
DB_DATABASE=:memory:
@jamescaldow
jamescaldow / nginx.conf
Created August 21, 2016 17:50
Nginx config file with SSL/TLS, security, speed and Cloudflare optimisations. (Work in progress)
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
@julianxhokaxhiu
julianxhokaxhiu / pagespeed_optimize_images.sh
Last active April 15, 2024 22:49
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
#!/bin/bash
# Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
find . -type f -iname "*.png" -exec optipng -nb -nc {} \;
find . -type f -iname "*.png" -exec advpng -z4 {} \;
find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \;
@graydon
graydon / country-bounding-boxes.py
Created April 23, 2014 00:03
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),