Skip to content

Instantly share code, notes, and snippets.

@maxx1337
maxx1337 / redis-sentinel
Last active August 29, 2015 14:01 — forked from mathieue/sentinel
save redis-sentinel into /etc/init.d/
View redis-sentinel
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-sentinel
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts redis sentinel
# Description: Starts redis sentinel using start-stop-daemon
### END INIT INFO
@mathieue
mathieue / sentinel
Created February 4, 2013 16:19
redis sentinel startup script
View sentinel
#!/bin/bash
### BEGIN INIT INFO
# Provides: redis sentinel
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts redis sentinel
# Description: Starts redis sentinel using start-stop-daemon
### END INIT INFO
View Run services using Docker
#### Postgres
# Run Postgres 10
sudo docker run --rm --name postgres10 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRE_PORT=5433 -p 5433:5432 postgres:10
# Connect to Postgres 10
psql -p 5433 -U postgres -h 172.17.0.1
@shiroyasha
shiroyasha / dog.rb
Created February 16, 2016 22:20
Method tracer for Ruby classes
View dog.rb
class Dog
attr_writer :name
def initialize(name)
@name = name
end
def bark
puts "patrick"
end
@dyerc
dyerc / sidekiq
Last active February 27, 2020 10:45
Sidekiq init script
View sidekiq
#!/bin/bash
# sidekiq Init script for Sidekiq
# chkconfig: 345 100 75
#
# Description: Starts and Stops Sidekiq message processor for Stratus application.
#
# User-specified exit parameters used in this script:
#
# Exit Code 5 - Incorrect User ID
# Exit Code 6 - Directory not found
@joekr
joekr / Dockerfile-Nginx
Last active April 14, 2021 13:24
Kubernetes + Rails (NGINX & Unicorn) on GCE
View Dockerfile-Nginx
# Set nginx base image
FROM nginx
# Copy custom configuration file from the current directory
COPY nginx.conf /etc/nginx/nginx.conf
@profh
profh / decode_session_cookie.rb
Last active June 23, 2021 13:25
A simple script to decode Rails 4 session cookies
View decode_session_cookie.rb
@markbates
markbates / gist:4240848
Created December 8, 2012 16:06
Getting Started with Rack
View gist:4240848

If you're writing web applications with Ruby there comes a time when you might need something a lot simpler, or even faster, than Ruby on Rails or the Sinatra micro-framework. Enter Rack.

Rack describes itself as follows:

Rack provides a minimal interface between webservers supporting Ruby and Ruby frameworks.

Before Rack came along Ruby web frameworks all implemented their own interfaces, which made it incredibly difficult to write web servers for them, or to share code between two different frameworks. Now almost all Ruby web frameworks implement Rack, including Rails and Sinatra, meaning that these applications can now behave in a similar fashion to one another.

At it's core Rack provides a great set of tools to allow you to build the most simple web application or interface you can. Rack applications can be written in a single line of code. But we're getting ahead of ourselves a bit.

@Faheetah
Faheetah / Jenkinsfile.groovy
Last active March 20, 2023 19:17
Jenkinsfile idiosynchrasies with escaping and quotes
View Jenkinsfile.groovy
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
View captcha_minteye.md

minteye is a captcha system where you try to find the original image out of distorted ones. They also have a feature list on their website but they forgot the view from a computer. I fixed it:

minteye captcha features

There are two ways to crack this captcha easily. I've used the audio challange. There are three different kind of audio messages.

  1. move the slider to the right
  2. move the slider to the left
  3. slider is in the correct position