Skip to content

Instantly share code, notes, and snippets.

View richsage's full-sized avatar

Rich Sage richsage

View GitHub Profile
@igorvoltaic
igorvoltaic / useradd.sh
Last active March 8, 2024 09:36
Create new user using command line in Mac OS X. Do not forget to set correct permissions for the file.
#!/bin/sh
if [[ `id -u` != 0 ]]; then
echo "Must be root to run script"
exit
fi
read -p "Enter user name and press [ENTER]: " UserName
if [[ $UserName == `dscl . -list /Users UniqueID | awk '{print $1}' | grep -w $UserName` ]]; then
@nagelflorian
nagelflorian / buckets.tf
Last active February 12, 2024 07:44
Terraform config for static website hosting on AWS
# AWS S3 bucket for static hosting
resource "aws_s3_bucket" "website" {
bucket = "${var.website_bucket_name}"
acl = "public-read"
tags {
Name = "Website"
Environment = "production"
}
@leonardofed
leonardofed / README.md
Last active May 3, 2024 01:24
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@szeidler
szeidler / d8-responsive-image-programmatically.php
Created March 15, 2016 08:42
Load and render responsive image from field in Drupal 8
<?php
function _load_header_image($variables) {
if ($node = $variables['node']) {
// Load main_image
$file = $node->field_main_image->entity;
if ($file) {
$variables = array(
'responsive_image_style_id' => 'header_image',
'uri' => $file->getFileUri(),
@benlinton
benlinton / multiple_mysql_versions_for_development.md
Last active September 23, 2023 09:38
Multiple MySQL Versions with Homebrew

Multiple MySQL Versions for Development

Options included below:

  • Using Docker docker-compose
  • Using Homebrew brew

Using Docker (recommended)

This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via brew any longer. Instead consider adding a barebones docker-compose.yml for each project and run docker-compose up to start each project's mysql service.

@almost
almost / async-await-lightning-talk.md
Last active September 12, 2019 09:07
Reactive 2015 Lightning Talk Proposal: Pyramids be gone!: ES7 Async Function

This is a proposal for a lightning talk at the Reactive 2015 conference.

NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut! You could also Retweet if you want :)

Pyramids be gone!

ES7 Async Functions

JavaScript is getting async functions (or already has them if you count Babel.JS) and with them a way to finally slay the evil pyramid. This new language feature lets you write asynchronous code that almost looks synchronous, while maintaining the same semantics as promises. This lets you shed your .then and .catch boilerplate and escape those nested callbacks in favour of clean, explicit, maintainable code.

@mietek
mietek / set-up-l2tp-ipsec-vpn-on-debian.md
Last active October 22, 2023 12:25
Set up L2TP/IPsec VPN on Debian

Set up L2TP/IPsec VPN on Debian

Set up IPsec

Set up networking

Install raspbian, set up your users however you would like, so long as you have sudo access on the user you are running this with. You probably want to resize the image so it fills the SD card as well.

  1. Copy this entire gist to your raspberry pi
  2. Do chmod +x step1.sh step2.sh iptables.sh in the gist folder (so that
  3. Run step1.sh a) This script does a few things - it first updates your raspberry pi, then it installs a few needed utilities, then it upgrades the firmware on your raspberry pi
anonymous
anonymous / main.js
Created November 25, 2013 10:17
reload sf2 wdt on ajax request
$(document).ajaxComplete(function(event, XMLHttpRequest){
var token = XMLHttpRequest.getResponseHeader('x-debug-token'),
protocol = window.location.protocol,
hostname = window.location.hostname;
if(token) {
$.get(protocol+'//'+hostname+'/_wdt/'+token, function(data){
@jakzal
jakzal / behat-runner.sh
Last active June 7, 2016 01:24
Running behat scenarios parallelized (by sprint)
#!/usr/bin/env bash
# finds all sprint tags (like @sprint:42) and runs them in a reversed order (won't run not tagged scenarios)
PARALLEL_COMMAND='parallel --gnu'
#PARALLEL_COMMAND='xargs -I{}'
BEHAT_COMMAND='./bin/behat --ansi --tags={}'
grep '@sprint:' features/*.feature | sed -e 's/.*\(@sprint:[0-9]*\).*/\1/' | sort -ur | $PARALLEL_COMMAND $BEHAT_COMMAND