Skip to content

Instantly share code, notes, and snippets.

View Ghostscypher's full-sized avatar

Brian Ngetich Ghostscypher

View GitHub Profile
@asabaylus
asabaylus / gist:3071099
Created July 8, 2012 14:12
Github Markdown Heading Anchors

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)

<html>
<!-- You may need to download them from https://github.com/brix/crypto-js/tree/release-3.1.2/build -->
<script src="rollups/sha1.js"></script>
<script src='components/lib-typedarrays-min.js'></script>
<body>
<script>
function sha1sum() {
var oFile = document.getElementById('uploadFile').files[0];
var sha1 = CryptoJS.algo.SHA1.create();
var read = 0;
@ygotthilf
ygotthilf / jwtRS256.sh
Last active July 22, 2024 13:05
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@dangtrinhnt
dangtrinhnt / update_moodle_photo.php
Created November 19, 2015 02:00
Update moodle user's photo programmatically
#!/usr/bin/php
<?php
// USAGE:
// $ php update_moodle_photo.php <user-id-number>
//
// to be able to run this file as command line script
define('CLI_SCRIPT', true);
// include config.php from your moodle's docroot
require_once('/var/www/moodle/config.php');
@turbo
turbo / std.md
Last active June 24, 2024 03:00
Git Commit Message Standard

Merged from https://github.com/joelparkerhenderson/git_commit_message and https://chris.beams.io/posts/git-commit/

General Rules

  • Commit messages must have a subject line and may have body copy. These must be separated by a blank line.
  • The subject line must not exceed 50 characters
  • The subject line should be capitalized and must not end in a period
  • The subject line must be written in imperative mood (Fix, not Fixed / Fixes etc.)
  • The body copy must be wrapped at 72 columns
  • The body copy must only contain explanations as to what and why, never how. The latter belongs in documentation and implementation.
@krmgns
krmgns / each.php
Last active October 28, 2022 09:47
Polyfill for "each" function that was removed as of PHP/8
<?php
if (!function_exists('each')) {
function each(array &$array) {
$value = current($array);
$key = key($array);
if (is_null($key)) {
return false;
}