Skip to content

Instantly share code, notes, and snippets.

View eznix86's full-sized avatar
🎯
Focusing

Bruno Bernard eznix86

🎯
Focusing
View GitHub Profile
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active September 10, 2023 10:12
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
# Build an inverted index for a full-text search engine with Redis.
# Copyright (C) 2009 Salvatore Sanfilippo. Under the BSD License.
# USAGE:
#
# ruby invertedindex.rb add somedir/*.c
# ruby invertedindex.rb add somedir/*.txt
# ruby search your query string
require 'rubygems'
require 'redis'
/*
The MIT License (MIT)
Copyright (c) 2014 Ismael Celis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@benbalter
benbalter / fork-a-branch.sh
Created December 11, 2012 19:39
How to fork a single branch of a repo, preserving commit log
mkdir target-repo
cd target-repo
git init
git remote add origin [email protected]...
git remote add upstream [email protected]....
git fetch upstream
git pull upstream master
git push origin master
Alternative:
@kernelp4nic
kernelp4nic / Redis-Ruby_Inverted-Index-Search-(Antirez)
Last active December 7, 2020 19:08 — forked from antirez/gist:120067
Build an inverted index for a full-text search engine with Redis.
--

Livestreaming via PS4 to a local RTMP server

Live stream from your PS4 to a local computer running an RTMP server by intercepting the twitch.tv stream.

Requirements

  • DD-WRT enabled Router (or router with iptables compatibility)
  • nix Envirment
  • nginx with the nginx-rtmp-module
@tianweidut
tianweidut / remote_pdb.py
Created August 25, 2014 03:18
pdb in subprocess
#ref: http://stackoverflow.com/questions/4716533/how-to-attach-debugger-to-a-python-subproccess
import sys
import pdb
class ForkedPdb(pdb.Pdb):
"""A Pdb subclass that may be used
from a forked multiprocessing child
"""
@tmilos
tmilos / README.md
Last active July 29, 2024 08:33
Modified Preorder Tree Traversal

Modified Preorder Tree Traversal

Hierarchical data metrics that allows fast read operations on tree like structures.

Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.

Sample implementation

@budhash
budhash / Redis-Ruby_Inverted-Index-Search-(Antirez)
Created September 30, 2015 03:10 — forked from kernelp4nic/ Redis-Ruby_Inverted-Index-Search-(Antirez)
Build an inverted index for a full-text search engine with Redis.
--
@joshnuss
joshnuss / app.js
Last active October 20, 2024 14:03
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection