Skip to content

Instantly share code, notes, and snippets.

@hanxue
hanxue / ffmpeg.txt
Created March 11, 2019 18:42
youtube-dl ffmpeg post processor not found
$ ffmpeg
dyld: Library not loaded: /usr/local/opt/x265/lib/libx265.165.dylib
Referenced from: /usr/local/bin/ffmpeg
Reason: image not found
Abort trap: 6
@januszm
januszm / change_eb_ruby_version.sh
Last active October 17, 2022 20:16
Change Ruby minor version in AWS Elastic Beanstalk
# Currently (2017/2018) it's not possible to change the Ruby 'minor' version (eg. 2.3 => 2.4) using the web console
# However, it's possible using the 'awscli' tool.
brew install awscli # pip install awscli
aws elasticbeanstalk update-environment \
--solution-stack-name "64bit Amazon Linux 2017.09 v2.6.1 running Ruby 2.4 (Puma)" \
--environment-name "myappenv1" --region "us-east-2" \
--version-label "app-1234-210000_120123"
# For Amazon Linux 2
@maxdbn
maxdbn / sidekiq.config
Last active May 23, 2021 12:05
Gracefully restarting Sidekiq on Elasticbeanstalk, only after it's done with the running jobs. Tested on: 64bit Amazon Linux 2016.09 v2.3.0 running Ruby 2.3 (Puma). Thanks to ssaunier for the original gist! https://gist.github.com/ssaunier/44bbebb9c0fa01953860
# Sidekiq interaction and startup script
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
owner: root
group: root
@edwardsharp
edwardsharp / bucket_sync_service.rb
Created May 10, 2016 23:18
ruby class to copy from one aws s3 bucket to another based on bantic/bucket_sync_service.rb
require 'aws-sdk'
class BucketSyncService
attr_reader :from_bucket, :to_bucket, :logger
attr_accessor :debug
DEFAULT_ACL = "public-read"
def initialize(from_bucket, to_bucket)
@klappradla
klappradla / post-deploy.yml
Created November 27, 2015 12:12
Rake tasks as post deploy hooks for AWS Elastic Beanstalk Puma-Rails applications
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/01_do_stuff.sh" :
mode: "000755"
owner: ec2-user
group: ec2-user
content: |
#! /usr/bin/env bash
# Using similar syntax as the appdeploy pre hooks that is managed by AWS
set -xe
@haasn
haasn / about:config.md
Last active April 2, 2024 18:46
Firefox bullshit removal via about:config

Firefox bullshit removal

Updated: Just use qutebrowser (and disable javascript). The web is done for.

@eliotsykes
eliotsykes / rails_new_help_output.md
Last active March 31, 2024 17:09
"rails new" options explained

Run rails new --help to view all of the options you can pass to rails new:

$ bin/rails new --help
Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]                                      # Path to the Ruby binary of your choice
                                                         # Default: /Users/eliot/.rbenv/versions/2.2.0/bin/ruby
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active May 16, 2024 13:16
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@markusklems
markusklems / lambda-dynamodb-scan
Created January 19, 2015 23:46
Short aws lambda sample program that scans a dynamodb table
// create an IAM Lambda role with access to dynamodb
// Launch Lambda in the same region as your dynamodb region
// (here: us-east-1)
// dynamodb table with hash key = user and range key = datetime
console.log('Loading event');
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10'});
exports.handler = function(event, context) {
@SauloSilva
SauloSilva / each_slice.js
Last active May 8, 2019 16:09
Each slice javascript
// without callback
Array.prototype.eachSlice = function (size){
this.arr = []
for (var i = 0, l = this.length; i < l; i += size){
this.arr.push(this.slice(i, i + size))
}
return this.arr
};
[1, 2, 3, 4, 5, 6].eachSlice(2)