Skip to content

Instantly share code, notes, and snippets.

View petrosp's full-sized avatar

Petros petrosp

  • AMS-IX
  • Amsterdam
View GitHub Profile
@scottstanfield
scottstanfield / .zshrc
Last active May 29, 2024 01:45
sensible, minimal .zshrc
# Sensible, short .zshrc
# Gist page: git.io/vSBRk
# Raw file: curl -L git.io/sensible-zshrc
# GNU and BSD (macOS) ls flags aren't compatible
ls --version &>/dev/null
if [ $? -eq 0 ]; then
lsflags="--color --group-directories-first -F"
else
lsflags="-GF"
@stephencarr
stephencarr / application.js
Last active March 4, 2017 13:05
Ember authorizer for simple-auth + devise-auth-token
// `adapters/application.js`
import Ember from 'ember';
import DS from 'ember-data';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
const { service } = Ember.inject;
import config from '../config/environment';
export default DS.JSONAPIAdapter.extend(DataAdapterMixin, {
authorizer: 'authorizer:devise',
@ipbastola
ipbastola / jq to filter by value.md
Last active April 16, 2025 08:11
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@mpugach
mpugach / Gemfile
Created October 6, 2016 10:03
Rails + Fluentd
gem 'act-fluent-logger-rails'
gem 'lograge'
@PavloBezpalov
PavloBezpalov / 1. ELK.install
Last active January 5, 2024 16:14
ELK Stack with Rails (Elasticsearch, Logstash, Kibana) on Ubuntu VPS
INSTALL JAVA
$ sudo apt-get update && sudo apt-get install default-jre
INSTALL ELASTIC SEARCH https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
$ wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
$ echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
$ sudo apt-get update && sudo apt-get install elasticsearch
$ sudo update-rc.d elasticsearch defaults 95 10
$ sudo service elasticsearch restart
$ sudo service elasticsearch status
@jazzido
jazzido / graphql.rb
Last active July 3, 2021 06:36
Neo4J + GraphQL — Toy example using graphql-ruby and neo4jrb
require 'graphql'
require 'neo4j'
neo4j_url = ENV['NEO4J_URL'] || 'http://localhost:7474'
session = Neo4j::Session.open(:server_db, neo4j_url)
class Author
include Neo4j::ActiveNode
id_property :id_author
@zentetsukenz
zentetsukenz / ruby_on_rails_deployment.md
Last active December 2, 2024 01:26
Deploy Ruby on Rails application with Docker Compose and Capistrano with ease

Docker

Files and Folders.

|
|\_ app
|...
|\_ docker
| |
@donilan
donilan / Dockerfile
Last active June 27, 2018 08:05
Mina deploy.rb with Docker-passenger, Pull this docker at registry.aliyuncs.com/doni/passenger if you are work from China.
FROM phusion/passenger-full
# Set correct environment variables.
ENV HOME /root
# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]
EXPOSE 80
@itsprdp
itsprdp / Dockerfile
Last active September 9, 2016 04:22
Kuber files for Rails App + Google Container Engine
# Dockerfile
# Using phusion passenger as base image.
# Refer - https://github.com/phusion/passenger-docker
FROM phusion/passenger-ruby22:latest
MAINTAINER Pradeep <[email protected]>
# Set ENV variables
ENV HOME /rubyapp/