Skip to content

Instantly share code, notes, and snippets.

Avatar

Razvan Tataru tatarurzvn

View GitHub Profile
View gist:99926b29746f04f2efba6119cc8496e6
pg_dump -j 4 --section=pre-data -Fc -d DB -h 127.0.0.1 -p 5432 -U postgres --schema public > pre_date
pg_dump -j 4 --section=data -Fc -Z 9 -d DB -h 127.0.0.1 -p 5432 -U postgres --schema public > data_date
pg_dump -j 4 --section=post-data -Fc -Z 9 -d DB -h 127.0.0.1 -p 5432 -U postgres --schema public > post_date
# -j4 -> because 4 tables
# Split per sections
# -Fc -> pg_restore format
# -Z 9 -> copression (cool if i need to scp it)
@tatarurzvn
tatarurzvn / check-redis.sh
Last active Jun 17, 2022
check running redises
View check-redis.sh
#!/usr/bin/env bash
for port in $(ps aux | perl -ne 'print if not /perl/ and not /63790/ and /redis-server/;' | perl -F'\s+' -lane '@arr = split /:/, "$F[-1]"; print $arr[1];'); do
echo "==> Clients connected to Redis on TCP port [$port] <==";
redis-cli -p $port client list;
done
@tatarurzvn
tatarurzvn / greedy.c
Created Nov 18, 2017
Greedy exercise
View greedy.c
#include <stdio.h>
#define MAX_WEIGHT 10
int getValoare(float values[], float weights[], int size)
{
int currentWeight = 0;
int currentValue = 0;
int i = 0;
@tatarurzvn
tatarurzvn / prime-check.sh
Created Nov 1, 2017
Shell(zsh) exercises: print n fibos, is prime and print n primes; CN Homework
View prime-check.sh
#!/bin/zsh
echo "Hey $USER, please enter a number: "
read NBR
CHECK=2
IS_PRIME=1
while [ $CHECK -lt `expr $NBR / 2` ]
do
if [ `expr $NBR % $CHECK` -eq 0 ]