Skip to content

Instantly share code, notes, and snippets.

View pepoviola's full-sized avatar
💭
🦀

Javier Viola pepoviola

💭
🦀
View GitHub Profile
@pepoviola
pepoviola / bash_strict_mode.md
Created October 16, 2023 19:13 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@pepoviola
pepoviola / get_ip.sh
Created August 24, 2023 13:24 — forked from LozanoMatheus/get_ip.sh
Get Linux IP without any tool
#!/usr/bin/env bash
## Get the primary and secundary IPs
awk '/\|--/ && !/\.0$|\.255$/ {print $2}' /proc/net/fib_trie
## Get only the primary IPs
awk '/32 host/ { print i } {i=$2}' /proc/net/fib_trie
@pepoviola
pepoviola / exporter.rs
Created July 15, 2021 13:25 — forked from eduardonunesp/exporter.rs
pdf-exporter
use std::fs::File;
use std::io::{prelude::*, BufReader, Write};
use std::process::Command;
use actix_multipart::Multipart;
use actix_web::{
get, http::StatusCode, post, web, App, Error, HttpResponse, HttpServer, Responder,
};
use futures::{StreamExt, TryStreamExt};
use tempdir::TempDir;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::time::{Duration, Instant};
struct Inspect<F>(F);
impl<F: Future> Future for Inspect<F> {
type Output = F::Output;
@pepoviola
pepoviola / tide_test.rs
Created September 10, 2020 13:31 — forked from BillBarnhill/tide_test.rs
An example Tide unit test in Rust, with a Request and checked Response
#[cfg(test)]
mod tests {
#[async_std::test]
async fn index_page() -> tide::Result<()> {
use tide::http::{Url, Method, Request, Response};
let mut app = tide::new();
app.at("/").get(|_| async { Ok("Hello, world!") });
let url = Url::parse("https://example.com").unwrap();
@pepoviola
pepoviola / boot.js
Last active August 29, 2015 14:16 — forked from jdx/boot.js
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
make install
DEFAULT_RUBY_VERSION="1.9.3-p125"
sudo apt-get update
sudo apt-get -y install curl git-core bzip2 build-essential zlib1g-dev libssl-dev autoconf libreadline6-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libgdbm-dev libncurses5-dev libtool bison pkg-config libffi-dev
if [ -x /usr/local/rvm/bin/rvm ]; then
echo "RVM Found..nothing to do";
else
echo "Installing RVM";