Skip to content

Instantly share code, notes, and snippets.

View mraaroncruz's full-sized avatar
🏃‍♂️

Aaron Cruz mraaroncruz

🏃‍♂️
View GitHub Profile
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active March 31, 2024 18:45 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@tristanwietsma
tristanwietsma / auth.go
Created May 15, 2014 04:15
Golang web server example
package main
import (
"encoding/base64"
"net/http"
"strings"
)
type handler func(w http.ResponseWriter, r *http.Request)
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@raprasad
raprasad / change_password.md
Last active March 15, 2024 17:21
django user; change password from shell

update django password

general changes

To use in dev environments

  • after python manage.py shell
from django.contrib.auth.models import User
@drmalex07
drmalex07 / README-setup-tunnel-as-systemd-service.md
Last active March 15, 2024 15:56
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@mupkoo
mupkoo / SocketContextWithRef.ts
Created April 21, 2020 20:26
Using React Hooks for Phoenix Socket/Channels
import React, { createContext, useContext, useRef } from 'react';
import { Socket } from 'phoenix';
import AuthContext from './AuthContext';
const SocketContext = createContext<Socket>({} as Socket);
const SocketConsumer = SocketContext.Consumer;
const SocketProvider: React.FC = ({ children }) => {
let token = useContext(AuthContext).token!;
let socketRef = useRef<{
@vdbelt
vdbelt / cloudflare-purge-cache-service-worker.js
Created August 21, 2018 11:43
A CloudFlare service worker that proxies purge cache requests. Example: https://example.com/__purge_cache?zone=XX
addEventListener('fetch', event => {
event.respondWith(purgeCache(event.request))
})
async function purgeCache(request) {
const url = new URL(request.url)