Skip to content

Instantly share code, notes, and snippets.

View lucasdavila's full-sized avatar
🌈

Lucas D'Avila lucasdavila

🌈
  • SC, Brasil
View GitHub Profile
@paul-krohn
paul-krohn / docker_x11_macOS.md
Last active March 23, 2024 09:30
Docker X11 macOS

Preamble

There is a longstanding issue/missing feature/bug with sockets on Docker on macOS; it may never work; you'll need to use a network connection between Docker containers and X11 on macOS for the foreseeable future.

I started from this gist and made some adjustments:

  • the volume mappings aren't relevant/used, due to the socket issue above.
  • this method only allows X11 connections from your Mac, not the entire local network, which would include everyone on the café/airport WiFi.
  • updated to include using the host.docker.internal name for the the container host, instead.
  • you have to restart XQuartz after the config change.
@jjb
jjb / file.md
Created February 4, 2018 16:27
Active Record Connection Management in Rails 5.1 or lower
@cschiewek
cschiewek / x11_docker_mac.md
Last active April 5, 2024 22:38
X11 in docker on macOS

To forward X11 from inside a docker container to a host running macOS

  1. Install XQuartz: https://www.xquartz.org/
  2. Launch XQuartz. Under the XQuartz menu, select Preferences
  3. Go to the security tab and ensure "Allow connections from network clients" is checked.
  4. Run xhost + ${hostname} to allow connections to the macOS host *
  5. Setup a HOSTNAME env var export HOSTNAME=`hostname`*
  6. Add the following to your docker-compose:
 environment:
@tony-gutierrez
tony-gutierrez / AWS_Single_LetsEncrypt.yaml
Last active March 7, 2024 11:29
AWS Elastic Beanstalk .ebextensions config for single instance free SSL using letsencrypt certbot and nginx. http://bluefletch.com/blog/domain-agnostic-letsencrypt-ssl-config-for-elastic-beanstalk-single-instances/
# Dont forget to set the env variable "certdomain", and either fill in your email below or use an env variable for that too.
# Also note that this config is using the LetsEncrypt staging server, remove the flag when ready!
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
//Example of underscore chaining
var users = [
{name: 'John', surname: 'Doe', age: 35},
{name: 'John 2', surname: 'Doe 2', age: 19},
{name: 'John 3', surname: 'Doe 3', age: 28},
{name: 'John 4', surname: 'Doe 4', age: 16},
{name: 'John 5', surname: 'Doe 5', age: 39}
];
//Iterate over users and sort them by age, pick first and transform to a sentence
@mootpointer
mootpointer / update_user.rb
Created May 6, 2015 02:28
Service to update a user
require 'active_support/core_ext/hash/slice'
module MyCompany
module Services
class UpdateUser
attr_reader :user, :params
def initialize user, params
@user, @params = user, params
end
# Retorna dados sobre o pregão
http://www.bmfbovespa.com.br/Pregao-Online/ExecutaAcaoCarregarDados.asp?CodDado=IBOV,ticker&CA=undefined
# Retorna ações e seus últimos valores negociados
http://www.bmfbovespa.com.br/Pregao-OnLine/ExecutaAcaoCarregarDados.asp?CodDado=Ticker
# Retorna o histórico do dia de um papel
http://www.bmfbovespa.com.br/Pregao-Online/ExecutaAcaoCarregarDadosPapeis.asp?CodDado=petr4
# Retorna dados de um papel
@robsonmarques
robsonmarques / .vimrc
Last active December 19, 2015 11:29
.vimrc
set nocompatible " Must come first because it changes other options.
" Manage the runtime path with Pathogen.
silent! call pathogen#runtime_append_all_bundles()
silent! call pathogen#helptags()
syntax enable " Turn on syntax highlighting.
filetype plugin indent on " Turn on file type detection.
set cc=80
@erwanjegouzo
erwanjegouzo / gist:5903791
Last active March 8, 2019 20:49
Dropbox sync
#DROPBOX SYNCING
#==============
# bash_profile
rm -rf .bash_profile
ln -s ~/Dropbox/.bash_profile .bash_profile
# Sublime 2 Preferences
cd ~/Library/Application\ Support/Sublime\ Text\ 2/
ln -s ~/Dropbox/appdata/sublime/Installed\ Packages ./Installed\ Packages
@tsabat
tsabat / security_manager.rb
Created August 6, 2012 18:56
security_manager.rb
require 'haml'
require 'java'
class JRubySecurityManager < java.lang.SecurityManager
def checkPermission(perm)
puts perm.inspect
#puts perm
end
#def checkWrite(f)