Skip to content

Instantly share code, notes, and snippets.

View samir's full-sized avatar
:octocat:
I may be slow to respond.

Samir M. Braga samir

:octocat:
I may be slow to respond.
View GitHub Profile
🟩🟨⬜ Speed Wordle
* scroll down for secret 5-word cheat sheet
* solve any Wordle in less than one minute with these words
* cheat sheet of 5 words that uses 24 / 26 unique English letters!
* comments + questions -> https://news.ycombinator.com/item?id=30459184
@lokhman
lokhman / ubuntu-hardening.md
Last active April 23, 2024 09:05
List of things for hardening Ubuntu

WARNING

May contain out of date information. Check the comments below!

The list of actions listed below was taken mostly from Book Of Zeus with minor modifications and did the job well for Ubuntu version, which was available at that moment (May 2016). This gist was created for internal use and was never meant to be discovered by the web, although Google managed to find and index this page, which was a great surprise for me. Please check the original source for the updated information (links are provided in most of the sections), and read the comments below: they provide more details about the usage experience.

System Updates

http://bookofzeus.com/harden-ubuntu/initial-setup/system-updates/

Keeping the system updated is vital before starting anything on your system. This will prevent people to use known vulnerabilities to enter in your system.

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@derwiki
derwiki / README.md
Last active September 27, 2023 17:50
Ruby module that you can use in a `before_action` on sensitive controllers for which you'd like a usage audit trail

Adding an audit log to your Rails app

If you have any sort of administrative interface on your web site, you can easily imagine an intruder gaining access and mucking about. How do you know the extent of the damage? Adding an audit log to your app is one quick solution. An audit log should record a few things:

  • controller entry points with parameter values
  • permanent information about the user, like user_id
  • transient information about the user, like IP and user_agent

Using the Rails framework, this is as simple as adding a before_action to your admin controllers. Here’s a basic version that I’m using in production.

@porjo
porjo / timelapse.md
Last active May 25, 2023 16:14
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

Simple glob:

ffmpeg -r 24 -i '*.JPG' -s hd1080 -vcodec libx264 timelapse.mp4

Start from DSC_0079.JPG

ffmpeg -r 24 -f image2 -start_number 79 -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse2.mp4
@tinogomes
tinogomes / gist:7ca162a0110be69a4a64
Last active July 14, 2023 22:12
Frases - Porta dos Fundos - Mundo dos Negócios

https://www.youtube.com/watch?v=cPbl26Fw-dk

  • Quer brincar de Eike Bastista nessa porra!
  • Matar um leão por dia.
  • Faca nos dentes
  • Sangue no olho
  • É matar ou morrer
  • Dando muque em macaco de gaveta
  • É largar mato na caçamba
  • Jogar terra na boca de carrapato
@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active December 1, 2023 04:55
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
@justinweiss
justinweiss / filterable.rb
Last active January 11, 2024 07:28
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with names based on the keys in <tt>filtering_params</tt>
# with their associated values. For example, "{ status: 'delayed' }" would call
@mrcasals
mrcasals / explanation.md
Last active August 29, 2015 13:56
rbenv: remove RUBY_FREE_MIN and RUBY_HEAP_MIN_SLOTS warnings on Ruby 2.1.0

rbenv: remove RUBY_FREE_MIN and RUBY_HEAP_MIN_SLOTS warnings on Ruby 2.1.0

If you are like me, then you might have some Ruby projects running on different Ruby versions, so you'll need to either upgrade those old projects to Ruby 2.1.10 or deal with these warnings:

/Users/marc/.rbenv/versions/2.1.0/bin/ruby: warning: RUBY_FREE_MIN is obsolete. Use RUBY_GC_HEAP_FREE_SLOTS instead.
/Users/marc/.rbenv/versions/2.1.0/bin/ruby: warning: RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead.
ruby: warning: RUBY_FREE_MIN is obsolete. Use RUBY_GC_HEAP_FREE_SLOTS instead.
ruby: warning: RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead.
@seyhunak
seyhunak / seeds.rb
Created December 7, 2013 14:54
Rails - Import SQL file as seed
unless Rails.env.production?
connection = ActiveRecord::Base.connection
connection.tables.each do |table|
connection.execute("TRUNCATE #{table}") unless table == "schema_migrations"
end
sql = File.read('db/import.sql')
statements = sql.split(/;$/)
statements.pop