Skip to content

Instantly share code, notes, and snippets.

View morgoth's full-sized avatar

Wojciech Wnętrzak morgoth

View GitHub Profile
@dhh
dhh / linux-setup.sh
Last active April 19, 2024 17:57
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl docker.io \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@jclusso
jclusso / update_campfire_github_action.yml
Last active February 5, 2024 17:18
Update Campfire with a GitHub Action that creates a PR.
name: Update Campfire Source
on:
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
@acidtib
acidtib / readme.md
Created August 28, 2023 17:56
kamal + github actions

Example of Kamal deployment from Github Actions.

Add your applications .env variables to the Github repo as a repository secret, you can find this under the repo settings => secrets and variables => actions

https://github.com/username/repo_name/settings/secrets/actions

you are going to need an ssh private key that your deployment server is aware of (add public key to servers .ssh/authorized_keys) and add the ssh private key as a repo secret

create action workflows

@ncr
ncr / limiter.rb
Last active February 5, 2024 18:21
Simple Limiter based on individual keys instead of Redis hashes which are impossible to expire individually
require 'redis'
require 'redis-namespace'
class Limiter
def initialize(name:, threshold:, interval:, time_span: 600, bucket_span: 5)
@name, @threshold, @interval, @time_span, @bucket_span = name, threshold, interval, time_span, bucket_span
raise ArgumentError if @interval > @time_span || @interval < @bucket_span
@redis ||= Redis::Namespace.new(:limiter, redis: $redis || Redis.new)
@krasnoukhov
krasnoukhov / 2013-01-07-profiling-memory-leaky-sidekiq-applications-with-ruby-2.1.md
Last active October 4, 2023 21:53
Profiling memory leaky Sidekiq applications with Ruby 2.1

My largest Sidekiq application had a memory leak and I was able to find and fix it in just few hours spent on analyzing Ruby's heap. In this post I'll show my profiling setup.

As you might know Ruby 2.1 introduced a few great changes to ObjectSpace, so now it's much easier to find a line of code that is allocating too many objects. Here is great post explaining how it's working.

I was too lazy to set up some seeding and run it locally, so I checked that test suite passes when profiling is enabled and pushed debugging to production. Production environment also suited me better since my jobs data can't be fully random generated.

So, in order to profile your worker, add this to your Sidekiq configuration:

if ENV["PROFILE"]
@neerajsingh0101
neerajsingh0101 / guideline.md
Last active April 24, 2017 23:46
How to file Active Record bug report

How to file Active Record bug report

In order to make it easier to verify Active Record bugs you are encouraged to file bug report using one of the templates mentioned below .

If you are using published versions of gems then all you need to create is a single gist file like this .

If you are using master version of rails then use this template . Note that in this case both Gemfile and test file are needed .

@malarkey
malarkey / Three Wise Monkeys.md
Created December 2, 2012 14:26
Three Wise Monkeys (NDA)

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?

@viniciusteles
viniciusteles / bench.rb
Created November 4, 2012 16:19
Picasa API access benchmarks
require 'rubygems'
require 'benchmark'
require 'httparty'
@picasa_user = '117499753694301708125'
class XmlFetcher
include HTTParty
format :xml
end
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@pcworld
pcworld / _README.md
Last active December 8, 2023 20:22
Linux Spotify Ad Mute