Skip to content

Instantly share code, notes, and snippets.

View gate3's full-sized avatar

Doyin Olarewaju gate3

View GitHub Profile
@gate3
gate3 / gist:21f70cff33613c99dad0ce481890bba6
Last active September 14, 2016 19:53
Create a parse user from logged in user
Hi,
I recently wanted to create a new user from a logged in user account. That was the easy part, i used cloud code to create the user.
The problem started when i attempted creating another user immediately after or at anytime after creating the current user. I kept
getting an invalid token exception.
After a lot of pondering and fruitless googling. I came to the realization that parse logs in a new user automatically, hence the
error, because the local user and the cloud code user would be different.
So the solution is that, as soon as you create a new user just logout the current user immediately in the success function of your
cloud code. For example:
@gate3
gate3 / nigeria.json
Last active October 11, 2016 23:47
A list of nigerian states and local government hosted on azure cdn in a json file
https://octopuserver.blob.core.windows.net/public/nigeria.json
@gate3
gate3 / auth.php
Created December 10, 2017 01:54 — forked from jcbagtas/auth.php
<?php
/**
* Get current Laravel active session from outside laravel instance.
* Tested Laravel 5.2
*
*
*/
function getLaravelUser()
{
require __DIR__ . '\path\to\bootstrap\autoload.php';
Verifying my Blockstack ID is secured with the address 18SUNQvTaC91szu4kUGsZc11pdEu6X6YUJ https://explorer.blockstack.org/address/18SUNQvTaC91szu4kUGsZc11pdEu6X6YUJ
@gate3
gate3 / git_push.desktop
Created April 29, 2018 09:05
Git push that requests user input for commit message
git add . && read -p "Input a message: " message && git commit -m "${message}" && git push
@gate3
gate3 / deepClone.js
Created July 5, 2018 11:02
Deepclone javascript function
function deepClone(object) {
//first check if it is any of the types seen as object in javascript
if(typeof object !== 'object'){
throw new Error('please provide an object')
}
/*
We need to compare using Object.prototype because typeof only comparse by type and type for dates and arrays are always object. While Object.prototype compares the constructor
*/
var clone = Object.prototype.toString.call(object) !== '[object Object]' ? object:{}
for(var i in object) {
@gate3
gate3 / Makefile
Created July 16, 2018 16:04 — forked from PhirePhly/Makefile
A crazy simple SMTP server, for educational purposes only.
default:
cc ccsmtp.c -o ccsmtpd -lpthread
@gate3
gate3 / spam.md
Created July 16, 2018 16:09 — forked from holiman/spam.md
Description of how Ethereum can be used to fight spam

Stopping spam

This blog post by Jonathan Brown suggested replacing SMTP with Ethereum blockchain; specifically, utilizing the log channel to monitor events.

With this approach, emails wouldn't actually be stored within the EVM (Ethereum Virtual Machine) storage, but every email would still be present in the blockchain blocks. The EVM log mechanism would make it simple for a full node to monitor and be alerted whenever an email was submitted.

I don't believe that this would be feasible in the real world, for several reasons

  • There are lots of email being sent, some of them quite large
  • Most people wouldn't want their emails forever on the blockchain, the future resiliency of GPG is unknown, and GPG encryption does not provide perfect forward secrecy. Once a key is compromised, all is revealed.
@gate3
gate3 / App.css
Last active April 26, 2019 10:08
COOKPAD WEB INTERVIEW TEST
@import '~antd/dist/antd.css';
html, body {
height: 100%;
font-size: inherit;
}
div.ant-layout-content{
background: #fff;
}
div.large-bg{
@gate3
gate3 / nodegit-private-clone-test.js
Created July 15, 2019 13:47 — forked from mojavelinux/nodegit-private-clone-test.js
Clone a private repository using nodegit
const git = require('nodegit')
const fs = require('fs-extra')
const { URL } = require('url')
const REPO_URL = 'git@github.com:org/path.git'
const CLONE_DIR = '/tmp/private-repo-clone-test'
;(async () => {
await fs.emptyDir(CLONE_DIR)
let authAttempted = false
await git.Clone.clone(REPO_URL, CLONE_DIR, {