Skip to content

Instantly share code, notes, and snippets.

View einnar82's full-sized avatar
Doing nice things.

Rannie Ollit einnar82

Doing nice things.
View GitHub Profile
einnar82 / gist:4f8c3054448157db14daf608f35715be
Created October 25, 2021 07:23 — forked from kitek/gist:1579117
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
//answer for
class FileOwners
public static function groupByOwners($files)
foreach($files as $key=>$value)
einnar82 /
Created September 8, 2021 09:01 — forked from hakre/

Extend from SoapClient Examples

Just a collection gist of some assorted example SOAPClients. Code must not be stable or useful under all circumstances, these are examples. Most of the code is outdated, so you won't need to use it any longer in production code. I've just collected and compiled this together out of interest, the information normally is scattered around.

If you need to a start with PHP's SOAPClient start with the PHP manual page of it and read through the comments as well. Double check with exisiting bug-reports if given as many things are fixed since a comment was left.

const axios = require('axios').default;
axios.interceptors.request.use(x => {
const headers = {
einnar82 /
Created May 10, 2021 06:33 — forked from LegitDongo/
SQLSRV PHP 7.2 Drivers that work for Laravel Homestead
# Best if added to `` so that this gets run every time the box is provisioned
# composer won't be able to download updates with an active proxy, and will hang trying to get the newest file
# You may want to comment this out based on your network configuration
sudo bash -c 'echo "export NO_PROXY=*" >> ~/.profile'
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update
sudo apt-get install php7.2-dev php7.2-xml mcrypt php-pear php-mbstring unixodbc unixodbc-dev -y --allow-unauthenticated
einnar82 / Laravel nginx config to redirect all requests to https and an exception URL that can still be accessible via http


One day in your Laravel app, you were required to redirect all http requests to https but need to make a certain URL route accessible via http for a certain reason; perhaps a portion of your javascript code needs to redirect to http URL but it can't because redirection to secure URL to insecure is prohibited. Therefore, in cases like this, you need to just allow just one URL to make an http connection.

NOTE: There are obvious security implications here so don't just follow this blindly and understand if this is really the solution you're looking for. The nginx config can somehow be improved, I just don't have the time yet. It sure do look redundant.

Understanding and examples

  • Redirect everything from http to https
einnar82 /
Created December 8, 2020 05:10 — forked from tanaikech/
Upload Files to Google Drive using Javascript

Upload Files to Google Drive using Javascript


At October 11, 2019, I published a Javascript library to to run the resumable upload for Google Drive. When this is used, the large file can be uploaded. You can also use this js library.


This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.

  • This sample uses gapi.
  • Before you use this, please enable Drive API at API console and carr
einnar82 /
Created July 8, 2020 23:58 — forked from giansalex/
docker-php-ext-install Reference
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 
einnar82 / django_crash_course.MD
Created April 9, 2020 03:25 — forked from bradtraversy/django_crash_course.MD
Commands for Django 2.x Crash Course

Django Crash Course Commands

# Install pipenv
pip install pipenv
# Create Venv
pipenv shell
einnar82 / stripNamespaceFromClassName.php
Created December 21, 2018 08:12 — forked from jasondmoss/stripNamespaceFromClassName.php
Strip the namespace from the class to get the actual class name
* Strip the namespace from the class to get the actual class name
* @param string $obj Class name with full namespace
* @return string
* @access public