Skip to content

Instantly share code, notes, and snippets.

View fitiavana07's full-sized avatar

Fitiavana Ramanandafy fitiavana07

  • Antananarivo, Madagascar
View GitHub Profile
@fitiavana07
fitiavana07 / clean_dangling_images.sh
Last active May 5, 2020 06:51
Clean dangling images in docker
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
@fitiavana07
fitiavana07 / reduce_size.sh
Last active May 4, 2020 17:31
Reduce video size
ffmpeg -i video_in.mp4 -s 640x480 -b:v 512k -acodec copy video.mp4
@fitiavana07
fitiavana07 / find_duplicate.md
Created October 17, 2019 14:19
Find duplicates in MongoDB

Here is how to find duplicates in MongoDB:

db.consumption.aggregate([{$group: {_id: {"StartDate":"$StartDate", "Type": "$Type", "Volume": "$Volume"}, "count": { "$sum": 1 }}}, {"$sort": {"count" : -1} }])2

This shows duplicates with the same StartDate, Type, Volume, and shows the duplicate counts as count.

@fitiavana07
fitiavana07 / sshd_config
Created June 25, 2019 12:45
sshd config file to allow password authentication
# $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@fitiavana07
fitiavana07 / install_compose.sh
Last active November 2, 2019 19:07
Install Docker and Docker Compose in Ubuntu 18, don't set user permission
#!/bin/sh
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
@fitiavana07
fitiavana07 / add_user.sh
Last active June 6, 2019 14:56
Install Docker on Ubuntu
#!/bin/sh
# User creation happens here
sudo useradd -m devops -s /bin/bash
# Change the password with passwd devops
@fitiavana07
fitiavana07 / timer_1.py
Last active May 14, 2019 07:56
Timer in python
import sys
import time
time_start = time.time()
seconds = 0
minutes = 0
while True:
try:
sys.stdout.write(
@fitiavana07
fitiavana07 / pyclock.py
Created May 14, 2019 07:22 — forked from eleisoncruz/pyclock.py
Real Time Clock. My very first Python app using Pygame as library.
#My very first Python program using Pygame library displaying real-time clock
import time,pygame
#initialize pygame library
pygame.init()
theFont=pygame.font.Font(None,72)
clock = pygame.time.Clock()
screen = pygame.display.set_mode([320, 200])
pygame.display.set_caption('Pi Time')
@fitiavana07
fitiavana07 / tmux.conf
Created April 4, 2019 07:15 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@fitiavana07
fitiavana07 / modify_with_sed.sh
Created February 25, 2019 14:51
Change occurences of a string in a file with sed
sed -i "s/__DOMAIN_NAME__/$DOMAIN_NAME/g" /etc/nginx/conf.d/default.conf