Skip to content

Instantly share code, notes, and snippets.

View bluetechy's full-sized avatar

bluetechy

  • Unicity International
  • Orem, UT
View GitHub Profile
@bluetechy
bluetechy / crypt.py
Created August 16, 2018 06:35 — forked from fideloper/crypt.py
Decrypt Laravel-encrypted value
import os
import base64
import json
from Crypto.Cipher import AES
from phpserialize import loads
def decrypt(payload):
data = json.loads(base64.b64decode(payload))
@bluetechy
bluetechy / laravel_encryption.py
Created August 16, 2018 06:35 — forked from nbah22/laravel_encryption.py
Laravel-compatible encryption and decryption in python
import os
import json
import hashlib
import hmac
import base64
from Crypto.Cipher import AES
from phpserialize import loads, dumps
def mcrypt_decrypt(value, iv):
@bluetechy
bluetechy / mb_str_pad.php
Created October 23, 2018 11:42 — forked from nebiros/mb_str_pad.php
mb_str_pad
<?php
/**
* mb_str_pad
*
* @param string $input
* @param int $pad_length
* @param string $pad_string
* @param int $pad_type
* @return string

BECOM SUDO USER:

sudo -s

INSTALL WEBSTATIC REPO FOR CENTOS/RED HAT 7:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
FROM centos:7
MAINTAINER Naoaki Obiki
RUN yum update -y
RUN yum group install -y 'Development Tools'
RUN yum install -y libxml2-devel wget
RUN wget "http://jp2.php.net/get/php-7.0.9.tar.gz/from/this/mirror" -P /usr/local/src/
RUN mv /usr/local/src/mirror /usr/local/src/php-7.0.9.tar.gz
RUN wget "http://pecl.php.net/get/pthreads-3.1.6.tgz" -P /usr/local/src/
@bluetechy
bluetechy / nginxproxy.md
Created April 6, 2019 05:45 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

<?php
// generate private/public key as follows:
// > openssl genrsa -out private.pem 2048
// > openssl rsa -in private.pem -outform PEM -pubout -out public.pem
$data = "String to encrypt";
$privKey = openssl_pkey_get_private('file:///path/to/private.pem');
$encryptedData = "";
@bluetechy
bluetechy / gist:4c214d415bcef8c02bc4a8483d3fc4c9
Created July 28, 2020 08:54 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path
@bluetechy
bluetechy / GitHub curl.sh
Created July 29, 2020 03:36 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@bluetechy
bluetechy / ngrx8_with_immer.ts
Created October 17, 2020 06:31 — forked from born2net/ngrx8_with_immer.ts
ngrx 8+ with immer and support for on() within reducer
import {createReducer} from '@ngrx/store';
import {on} from "@ngrx/store";
import produce, {Draft} from "immer";
export const initialUserState: IUserState = {
knownUsers: [user1, user2],
selectedUser: null,
scenes: null
};