Skip to content

Instantly share code, notes, and snippets.

View whoo's full-sized avatar

Dominique DERRIER whoo

  • Transition
  • Montreal
View GitHub Profile
#!/bin/bash
#updated ffmpeg progress indicator
#by Rupert Plumridge
#for updates visit www.prupert.co.uk
#Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England & Wales Licence
# Based on the ffmpegprogress bar from: http://handybashscripts.blogspot.com/2011/01/ffmpeg-with-progress-bar-re-work.html
# which was based on my initital progress script - circle of life and all that ;)
# version 2.0
# 07.04.2011
# now uses apparently better progress detection, based on duration of overall video and progress along the conversion
@whoo
whoo / VerifyIp.py
Last active June 28, 2016 02:04
Find Ip into subnet
#!/usr/bin/env python3
import ipaddress
### read ip from ip.txt
### check if there is a match in subnet files
ipfile=open("ip.txt")
for ip in [line[:-1] for line in ipfile]:
@whoo
whoo / CheckPwd.pl
Last active June 29, 2016 01:36
CheckPassword Compliance
#!/usr/bin/perl
$Pwd=$ARGV[0];
$MinPwd=8;
chop($Pwd);
if ($Pwd=~/[[:upper:]]/) { $maj=1; } else { $maj=0; }
if ($Pwd=~/[[:digit:]]/) { $dig=1; } else { $dig=0; }
if ($Pwd=~/[[:punct:]]/) { $car=1; } else { $car=0; }
if ($Pwd=~/[[:lower:]]/) { $min=1; } else { $min=0; }
@whoo
whoo / testpointer.c
Created July 1, 2016 19:10
Transforme void into int | fun with pointer
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
void *a;
a=malloc(sizeof(int)*1);
*((int *)a)=25;
printf("%d",*(int*)a);
free(a);
Add density before document
#convert -density 400 /tmp/pages.ps document.pdf
# convert -density 400 ../document -resize 2048x img%d.png
@whoo
whoo / GetMpv
Last active July 15, 2016 01:06
LciPlayer
#!/bin/bash
# $1 http://lci.tf1.fr/jt-13h/videos/2016/le-13-heures-du-14-juillet-2016-8764691.html
URL=$(wget -q "$1" -O- | perl -nle 'print $a if ($a) = $_ =~m|embedframe/.*c0K11([0-9]*)|'
echo $URL
mpv http://www.wat.tv/get/iphone/$URL.m3u8
cols=shutil.get_terminal_size((80, 20)).columns
MAX=cols-15
def pbar(cur,size):
elmt=int(cur/size*MAX)
print("\033[?25l",end="")
print("\033[0G[",end="")
print("#"*elmt,end="")
print("."*(MAX-elmt),end="")
print("] %d"%cur,end="")
#!/bin/bash
function Relink
{
x=1
for a in $OLDPWD/*JPG
do
c=$(printf %04d.jpg $x)
ln -s "$a" $c
x=$(($x+1))
int pingTCP(char *host)
{
int sockfd,ping=0;
struct hostent *hostent;
struct sockaddr_in sockaddr_in;
fd_set fdset;
struct timeval tv;
GET /_cat/indices?v
POST /_reindex?refresh&wait_for_completion=false
{
"source": {
"index": "logstash-2017.03.*"
},
"dest": {
"index": "logstash-2017-q1"
}
}