Skip to content

Instantly share code, notes, and snippets.

View dukex's full-sized avatar
✔️
Verified Account

Duke dukex

✔️
Verified Account
View GitHub Profile
@danilobatistaqueiroz
danilobatistaqueiroz / Best_Practices.md
Last active July 24, 2023 18:12
RabbitMQ and CloudAMQP

To get optimal performance, make sure your queues stay as short as possible all the time.
Longer queues impose more processing overhead.
We recommend that queues should always stay around 0 for optimal performance.

Em cenários com muitos consumers e publishers, o ideal é centralizar a criação de exchanges e queues, removendo essa permissão deles e fazendo essa gestão por uma equipe de admin.

Para garantir a entrega das mensagens o correto é usar consumer ack, broker ack e durable queue com persistent messages.
Pode-se utilizar quorum queues dependendo do cenário.

@ld100
ld100 / ArchLinuxWSL2.md
Last active October 3, 2024 20:31
Steps for setting up Arch Linux on WSL2

Migrating from Ubuntu on WSL to ArchLinux on WSL2

Obsolete notice

This document was created back in 2020 and might not be actual nowadays. It is not supported anymore, so use thise information at your own risk.

Upgrading to WSL 2

  • Download WSL2 Kernel
  • run wsl --set-default-version 2 in windows command line, so that all future WSL machine will use WSL2.
@tcjr
tcjr / messages.json
Last active December 25, 2015 06:59
Basic pagination with Ember
// The API accepts the page parameter and returns the pagination info in meta
{
"messages": [ ... ],
"meta": {
"pagination": {
"total_pages": 3,
"current_page": 1,
"total_count": 55
}
# Adapted from a C# example here:
# http://stackoverflow.com/questions/43224/how-do-i-calculate-a-trendline-for-a-graph
# And thanks to John Esser for helping figure out how to
# calculate the targets to stabilize a negative slope!
class LinearRegression
attr_accessor :slope, :intercept
# Pass in an array of values to get the regression on
@wnuqui
wnuqui / gist:4653064
Last active December 11, 2015 20:09
3 bare bone rails applications using 3 jruby application servers (all running in heroku cedar)
# JAVA_OPTS and Procfiles
JAVA_OPTS: -Djruby.memory.max=384m -Xmx384m -Xms256m -Xss512k -XX:+UseCompressedOops -XX:+PrintGCDetails
# puma backed app's Procfile
web: bundle exec rails server puma -p $PORT -e $RACK_ENV
# torquebox-lite backed app's Procfile
web: bin/torquebox-lite -b 0.0.0.0 -p $PORT --max-threads=8
@jensgro
jensgro / gist:3816624
Created October 2, 2012 06:06
The Current State Of Remote Debugging For Mobile

source: Addy Osmani https://plus.google.com/u/0/115133653231679625609/posts/Px3bQdQ2HDu

Remote debugging allows us to execute and capture code in remote devices, providing a way to inspect HTML, CSS and JavaScript and make live changes. In terms of mobile, this means a way for us to communicate with mobile devices so we can debug code on them directly rather than just relying on emulators.

The landscape for remote debugging your apps on mobile is quite strong at the moment.

Chrome for Android supports remote debugging via USB and allows you to debug using the Chrome Developer Tools. (See: https://developers.google.com/chrome/mobile/docs/debugging and Chrome for Android Remote Debugging for +Boris Smus's video walkthrough)

Opera has had support for remote debugging since 2008 and Dragonfly can remotely connect to Opera Mobile. (Tut: http://www.codegeek.net/blog/2012/mobile-debugging-with-opera-dragonfly/)

@dcrec1
dcrec1 / respond-to.sass
Created August 23, 2012 21:17
respond-to mixin
$mediaPhone: 480px !default
$mediaTablet: 768px !default
$mediaDesktop: 980px !default
$mediaLarge: 1200px !default
=respond-to($media)
@if $media == phone
@media only screen and (max-width: $mediaPhone)
@content
@else if $media == tablet
@yogthos
yogthos / gist:3260456
Created August 4, 2012 23:01
RSS in Clojure
(ns rss
(:use [clojure.xml :only [emit]])
(:import java.util.Date))
(defn format-time [time]
(.format (new java.text.SimpleDateFormat
"EEE, dd MMM yyyy HH:mm:ss ZZZZ") time))
(defmacro tag [id attrs & content]
`{:tag ~id :attrs ~attrs :content [~@content]})
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@scottsbaldwin
scottsbaldwin / linearregression.rb
Created February 3, 2012 23:14
Ruby Linear Regression Calculator
# Adapted from a C# example here:
# http://stackoverflow.com/questions/43224/how-do-i-calculate-a-trendline-for-a-graph
# And thanks to John Esser for helping figure out how to
# calculate the targets to stabilize a negative slope!
class LinearRegression
attr_accessor :slope, :intercept
# Pass in an array of values to get the regression on