Skip to content

Instantly share code, notes, and snippets.

View prezine's full-sized avatar
🧙‍♂️
Working from home

Precious Tom prezine

🧙‍♂️
Working from home
View GitHub Profile
@prezine
prezine / index.js
Created January 27, 2023 16:19
For Instagram
// This file is relative, it could be any name but the extension should be .js, as in javascript.
const Client = require('instagram-private-api').V1;
const device = new Client.Device('my_device');
const storage = new Client.CookieFileStorage(__dirname + '/cookies/my_account.json');
Client.Session.create(device, storage, 'my_username', 'my_password')
.then(session => {
return session.getAccount();
})
@prezine
prezine / app.js
Created March 14, 2022 18:18
BCM Developer Test
function shuffle(array) {
let currentIndex = array.length, randomIndex;
// While there remain elements to shuffle...
while (currentIndex != 0) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex--;
@prezine
prezine / .deps...npm...@openzeppelin...contracts-upgradeable...access...OwnableUpgradeable.sol
Created November 1, 2021 14:28
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.2+commit.661d1103.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
@prezine
prezine / Card.php
Last active December 20, 2022 16:36
Credit Card Validation in PHP
<?php
class Card {
public function getCCType($cardNumber) {
// Remove non-digits from the number
$cardNumber = preg_replace('/\D/', '', $cardNumber);
// Validate the length
$len = strlen($cardNumber);
if ($len < 15 || $len > 16) {
throw new Exception("Invalid credit card number. Length does not match");
@prezine
prezine / Hash.php
Last active September 8, 2020 11:04
My Hash PHP Class
<?php
/**
*
*/
class Encryption
{
public function mt_rand_str($l, $c = 'abcdefghijklmnopqrstuvwxyz1234567890')
{
for ($s = '', $cl = strlen($c)-1, $i = 0; $i < $l; $s .= $c[mt_rand(0, $cl)], ++$i);
return $s;
@prezine
prezine / SplClassLoader.php
Created July 3, 2020 09:19 — forked from jwage/SplClassLoader.php
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
var country_arr = new Array("Afghanistan", "Albania", "Algeria", "American Samoa", "Angola", "Anguilla", "Antartica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Ashmore and Cartier Island", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burma", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Clipperton Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo, Democratic Republic of the", "Congo, Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czeck Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Europa Islan