Skip to content

Instantly share code, notes, and snippets.

View rubenvarela's full-sized avatar

Rubén Varela rubenvarela

View GitHub Profile
@magnetikonline
magnetikonline / README.md
Last active March 14, 2024 22:48
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@razor-x
razor-x / server.py
Last active June 18, 2024 14:27
Python http.server that sets Access-Control-Allow-Origin header.
# Python http.server that sets Access-Control-Allow-Origin header.
# https://gist.github.com/razor-x/9542707
import os
import sys
import http.server
import socketserver
PORT = 8000
@moshen
moshen / init.lua
Created September 3, 2015 01:19
My hammerspoon configuration
-- Auto-reload config
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
if doReload then
hs.reload()
@damiankloip
damiankloip / drush.fish
Created November 23, 2015 10:13
Fish Drush completion
# Drush autocompletion
#
# Place this in your ~/.config/fish/completions/ directory, or in the
# /etc/fish/completions directory to make it available for all users.
function __complete_drush
drush --early=includes/complete.inc --verbose=0 (commandline -cpo) (commandline -t 2> /dev/null) | cut -d " " -f 1
end
complete -x -c drush -d "Drush" -a "(__complete_drush)"
@allysonsouza
allysonsouza / .htaccess
Created May 24, 2016 13:27
Enabling PHP 7 on Hostgator trough htaccess
# Habilitar o PHP 7.0
AddHandler application/x-httpd-php70 .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/php70/lib
</IfModule>
@milanboers
milanboers / clone.bash
Last active July 15, 2024 17:14
Clone all repositories of a Github user
curl -s https://api.github.com/users/milanboers/repos | grep \"clone_url\" | awk '{print $2}' | sed -e 's/"//g' -e 's/,//g' | xargs -n1 git clone
@mayel
mayel / up
Created July 20, 2017 14:50
up - script to keep your Mac up-to-date (OS, Homebrew, and App Store updates) via the command line
#!/bin/sh
# up - v2 - script to keep your Mac up-to-date (OS, Homebrew, and App Store updates) via the command line
# run thus to to install: cd /usr/local/bin && curl -s -O https://gist.githubusercontent.com/mayel/c07bc0acb91824501d5bdbdc9eb7b33a/raw/08821f64c067327ea68a1a817eb43657db10f10e/up && chmod 755 /usr/local/bin/up
# and then run it anytime by simply entering the command: up
# By https://github.com/mayel based on a script by https://github.com/imwally
# homebrew
@0xcaff
0xcaff / 0_README.md
Last active May 13, 2023 23:35
OpenVPN, rTorrent and Flood Docker Compose Configuration

The Setup

This is a docker-compose file for a simple, secure torrent setup. It includes [rTorrent] (a torrent client), [flood] (a web interface for rTorrent), [OpenVPN] (to tunnel traffic through your ISP) and a simple iptables firewall to allow rTorrent to only access the internet through a VPN.

To run everything, put your open vpn configuration file in ./vpn.ovpn and the other configuration files from this gist in a directory then go to that

@balachandrapai
balachandrapai / NLPBasics.py
Last active September 26, 2020 13:58
Basics of NLP using NLTK ( tokenizing words and sentences, stop words, stemming words, Lemmatization)
from nltk.corpus import stopwords
from nltk.tokenize import sent_tokenize, word_tokenize
##Tokenizing - Splitting sentences and words from the body of text.
##Part of Speech tagging
##Corpus - Body of text, singular. Corpora is the plural of this.
##Example: A collection of medical journals.
##Lexicon - Words and their meanings.
@anthumchris
anthumchris / README.md
Last active September 25, 2022 19:04
Clear Nginx Cache

Clearing Nginx's HTTP Cache

I recently implemented Nginx HTTP content caching on our WordPress web servers to improve page load speeds and eliminate redundant, unneeded server-side page rendering. Caching the pages was relatively straightforward, but clearing the cache required a custom workaround.

Nginx comes in two versions: free and “Nginx Plus” at $2,500/year. The free version of Nginx does not offer the needed cache-clearing features of Nginx Plus, and I wasn’t comfortable paying $20,000 for 8 instances without trying to build my own solution.

Our Nginx servers run as an HTTP proxy for multiple PHP/MySQL-backed WordPress sites. The goal was to cache the dynamic PHP HTML responses in Nginx and serve the HTML pages from Nginx to avoid redundant, CPU-intensive PHP renders.

Site Cache Configuration

The example below shows how PHP response caching is configured for a site (other nginx configuration details are excluded for brevity). A cache named cachedemo-prod is defined to store cached HTML f