Skip to content

Instantly share code, notes, and snippets.

View gate3's full-sized avatar

Doyin Olarewaju gate3

View GitHub Profile
@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';
@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 / 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 = '[email protected]: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, {
@gate3
gate3 / build.sh
Created December 9, 2019 22:57 — forked from bobbytables/build.sh
Protocol Buffer build script for multiple folders
#!/usr/bin/env bash
# This script is meant to build and compile every protocolbuffer for each
# service declared in this repository (as defined by sub-directories).
# It compiles using docker containers based on Namely's protoc image
# seen here: https://github.com/namely/docker-protoc
set -e
REPOPATH=${REPOPATH-/opt/protolangs}
CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"}
@gate3
gate3 / redis_cheatsheet.bash
Created October 16, 2021 15:04 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@gate3
gate3 / TetherToken.sol
Created December 6, 2021 13:33 — forked from plutoegg/TetherToken.sol
TetherToken.sol - Tether.to USD
pragma solidity ^0.4.11;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
@gate3
gate3 / example.go
Created August 5, 2022 15:03 — forked from yanmhlv/example.go
JSONB in gorm
package main
import (
"database/sql/driver"
"encoding/json"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)