Skip to content

Instantly share code, notes, and snippets.

View rasata's full-sized avatar
😉

Zo-Hasina Rasatavohary rasata

😉
  • Zonova
  • France
View GitHub Profile
@rasata
rasata / replace.sh
Created July 1, 2016 09:33 — forked from hlissner/replace.sh
Bulk search & replace with ag (the_silver_searcher)
# ag <https://github.com/ggreer/the_silver_searcher>
# usage: ag-replace.sh [search] [replace]
# caveats: will choke if either arguments contain a forward slash
# notes: will back up changed files to *.bak files
ag -l $1 | xargs perl -pi.bak -e "s/$1/$2/g"
# or if you prefer sed's regex syntax:
ag -l $1 | xargs sed -ri.bak -e "s/$1/$2/g"
@rasata
rasata / yaml2dot.py
Created September 15, 2016 09:24 — forked from nakamuray/yaml2dot.py
YAML to dot translator
#!/usr/bin/python
# vim: fileencoding=utf-8
u'''Translate YAML written text to graphviz dot language
Input YAML text like below:
---
employee:
- name
- age
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@rasata
rasata / web-servers.md
Created January 16, 2017 14:11 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@rasata
rasata / start_docker_registry.bash
Created October 10, 2017 12:01 — forked from PieterScheffers/start_docker_registry.bash
Start docker registry with letsencrypt certificates (Linux Ubuntu)
#!/usr/bin/env bash
# install docker
# https://docs.docker.com/engine/installation/linux/ubuntulinux/
# install docker-compose
# https://docs.docker.com/compose/install/
# install letsencrypt
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
# Fail2Ban configuration file
#
# Author: Russell Odom <russ@gloomytrousers.co.uk>
# Adapted for sendmail by: Mike A. Leonetti
# Sends a complaint e-mail to addresses listed in the whois record for an
# offending IP address.
#
# You should provide the <logpath> in the jail config - lines from the log
# matching the given IP address will be provided in the complaint as evidence.
#
@rasata
rasata / sshuttle.sh
Created April 10, 2018 13:22 — forked from Davor111/sshuttle.sh
How to use sshuttle with .key, .csr or .pem files for authentication
#It's not directly mentioned in the documentation on how to do this, so here you go. This command will tunnel everything including DNS:
sshuttle --dns -vr user@yourserver.com 0/0 --ssh-cmd 'ssh -i /your/key/path.pem'
@rasata
rasata / Docker Snippets
Created April 10, 2018 13:23 — forked from dchapkine/Docker Snippets
Docker Snippets
# Build
IMAGEID=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1) && sudo docker build -t $IMAGEID .
# Run new container
CONTAINER_ID=$(sudo docker run -t -d -p 0.0.0.0:81:80 $IMAGEID)
# Login into running containe. REQUIRES DOCKER >= 1.3
sudo docker exec -it $CONTAINER_ID bash
# !!! DEPRECATED !!! Login into running container. REQUIRES DOCKER < 0.9
@rasata
rasata / angular-1-file-upload-example.html
Last active April 23, 2018 10:22 — forked from iffy/index.html
Angular 1 File Upload example
<!DOCTYPE html>
<html lang="en">
<body ng-app="myapp" ng-controller="UploadCtrl">
<input type="file" file-change="upload">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script>
// the javascript
var app = angular.module('myapp', []);
@rasata
rasata / Dockerfile-es
Created August 14, 2018 10:15 — forked from wshayes/Dockerfile-es
Elasticsearch and Kibana using docker-compose (v3)
FROM docker.elastic.co/elasticsearch/elasticsearch:5.5.1
RUN \
mv /usr/share/elasticsearch/plugins/x-pack /usr/share/elasticsearch/plugins/.removing-x-pack && \
mv /usr/share/elasticsearch/plugins/.removing-x-pack /usr/share/elasticsearch/plugins/x-pack && \
/usr/share/elasticsearch/bin/elasticsearch-plugin remove x-pack