Skip to content

Instantly share code, notes, and snippets.

View edgar's full-sized avatar

Edgar Gonzalez edgar

View GitHub Profile
@edgar
edgar / pre-commit
Last active November 24, 2022 13:42 — forked from FerPerales/pre-commit.sh
Git: Pre-commit git hook that prevents commits with undesired words, usually debugging statements #git #hook #pre-commit
# This script verifies if a list of "undesired" words are presented in the files you are intended to commit such console
# output, debugging information or keys/tokens/passwords
# Based on the git hook created by Mark Story
# http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes
# Instructions:
# Put this file into your .git/hooks folder and set as executable (chmod +x pre-commit)
@edgar
edgar / openconnect_vpn.zsh
Created August 10, 2020 16:47
ZSH functions to start/stop OpenConnect
#
# ZSH functions to start/stop OpenConnect VPN client
#
# In my setup the VPN username is the same as $USER
#
export VPN_HOST=<your VPN host>
function vpn-up() {
if [[ -z $VPN_HOST ]]
then
@edgar
edgar / checkpoint.sh
Created December 31, 2021 18:02 — forked from havenokarma/checkpoint.sh
Endpoint Security VPN FULL start/stop script for Mac OS X
#!/bin/bash
#
# The reason of creating this script is that Endpoint Security VPN installs it's own application firewall kext cpfw.kext
# which prevents for example PPTP connections from this computer, which is not appropriate if you need subj connection just
# from time to time
#
# Usage: ./checkpoint.sh
#
# The script checks if Enpoint Security VPN is running. If it is, then it shuts it down, if it is not, it fires it up.
# Or, make an Automator action and paste the script.
@edgar
edgar / gist:7be8459b8e281464ae06faec15227f28
Last active February 5, 2021 10:19
Run spotify/kafka docker
docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=localhost --env ADVERTISED_PORT=9092 spotify/kafka
docker run -it --rm spotify/kafka /bin/bash
$KAFKA_HOME/bin/kafka-console-producer.sh --broker-list 172.17.0.2:9092 --topic test
docker run -it --rm spotify/kafka /bin/bash
$KAFKA_HOME/bin/kafka-console-consumer.sh --zookeeper 172.17.0.2:2181 --topic test
@edgar
edgar / Yarn Upgrade Indirect Dependencies.md
Created February 4, 2021 18:46 — forked from pftg/Yarn Upgrade Indirect Dependencies.md
Update indirect dependencies in yarn.lock. `ruby rejuvenation.rb & yarn install`
$> curl "https://gist.githubusercontent.com/pftg/fa8fe4ca2bb4638fbd19324376487f42/raw/f9056244c416d2f56d6d94290e5ecef5960abf66/rejuvenation.rb" | ruby

or

$> ruby rejuvenation.rb
$> yarn install
@edgar
edgar / docker-compose.yml
Created August 13, 2020 01:39
Docker compose file to run Minecraft Bedrock servr
version: '3.4'
services:
bds:
image: itzg/minecraft-bedrock-server
environment:
EULA: "TRUE"
GAMEMODE: creative
DIFFICULTY: hard
LEVEL_SEED: "2006386677"
@edgar
edgar / resque.rake
Created July 2, 2020 00:36 — forked from ewherrmann/resque.rake
Collection of Resque related custom rake tasks from around the web
require 'resque/tasks'
namespace :resque do
def del(key)
Resque.redis.keys(key).each { |k| Resque.redis.del(k) }
end
desc "Resque setup according to installation guide"
task :setup => :environment
@edgar
edgar / docker-compose.yml
Created April 21, 2020 21:22 — forked from seanhandley/docker-compose.yml
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
Gem::Version.new('0.3.2') < Gem::Version.new('0.10.1')
=> true
Gem::Version.new('0.3.0') == Gem::Version.new('0.3')
=> true
# frozen_string_literal: true
module ErrorResponses
def rails_respond_without_detailed_exceptions
env_config = Rails.application.env_config
original_show_exceptions = env_config['action_dispatch.show_exceptions']
original_show_detailed_exceptions = env_config['action_dispatch.show_detailed_exceptions']
env_config['action_dispatch.show_exceptions'] = true
env_config['action_dispatch.show_detailed_exceptions'] = false
yield
ensure