Skip to content

Instantly share code, notes, and snippets.

View vzool's full-sized avatar
🎯
Focusing

Abdelaziz Elrashed vzool

🎯
Focusing
  • Sudan
View GitHub Profile
@vzool
vzool / Php-Encryption_Curve25519_Test.php
Last active June 2, 2018 21:17
A test that use Php-Encryption and exchange keys by Curve25519
<?php
/*
* For testing you will need the following packages:
*
* - paragonie/random_compat
*
* - defuse/php-encryption
*
* - leigh/curve25519
*/
@mihow
mihow / load_dotenv.sh
Last active May 29, 2024 15:51
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
@rms1000watt
rms1000watt / golang-template-if-and.go
Last active July 13, 2023 20:10
Golang script for using templates with IF and AND
package main
import (
"fmt"
"os"
"text/template"
)
type Person struct {
Name string

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@joepie91
joepie91 / blockchain.md
Last active June 25, 2023 08:40
Is my blockchain a blockchain?

Your blockchain must have all of the following properties:

  • It's a merkle tree, or a construct with equivalent properties.
  • There is no single point of trust or authority; nodes are operated by different parties.
  • Multiple 'forks' of the blockchain may exist - that is, nodes may disagree on what the full sequence of blocks looks like.
  • In the case of such a fork, there must exist a deterministic consensus algorithm of some sort to decide what the "real" blockchain looks like (ie. which fork is "correct").
  • The consensus algorithm must be executable with only the information contained in the blockchain (or its forks), and no external input (eg. no decisionmaking from a centralized 'trust node').

If your blockchain is missing any of the above properties, it is not a blockchain, it is just a ledger.

@xcsrz
xcsrz / server.go
Created January 2, 2016 07:12
A golang web server on a randomly (os) chosen port.
package main
import (
"fmt"
"github.com/skratchdot/open-golang/open"
"net"
"net/http"
)
func main() {
@endel
endel / number-pad-zero.js
Last active August 1, 2023 11:54
Simplest way for leading zero padding in JavaScript
Number.prototype.pad = function(size) {
var s = String(this);
while (s.length < (size || 2)) {s = "0" + s;}
return s;
}
(1).pad(3) // => "001"
(10).pad(3) // => "010"
(100).pad(3) // => "100"
@fntlnz
fntlnz / yubikey-fedora-udev.md
Last active March 9, 2020 10:24
Yubikey U2F Token CentOS/RHEL/Fedora udev rules

To use a yubico U2F token on CentOS/RHEL/Fedora you need to add the specific udev file to your system to recognize them.

Get the udev rules

wget -O /etc/udev/rules.d/70-u2f.rules https://raw.githubusercontent.com/Yubico/libu2f-host/master/70-u2f.rules

Reload device events

@jrmadsen67
jrmadsen67 / gist:bd0f9ad0ef1ed6bb594e
Last active February 15, 2022 08:41
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
anonymous
anonymous / activity_main.xml
Created April 8, 2015 22:18
RelativeLayout XML for Udacity quiz question
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<TextView
android:text="I’m in this corner"
android:layout_height="wrap_content"
android:layout_width="wrap_content"