Skip to content

Instantly share code, notes, and snippets.

View jbdrvl's full-sized avatar
🌴
On vacation

jbdrvl

🌴
On vacation
View GitHub Profile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% LaTeX TEMPLATE - Project/Research Report
%
% This original template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author of the Title page:
% WikiBooks (http://en.wikibooks.org/wiki/LaTeX/Title_Creation)
% License: CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
@jbdrvl
jbdrvl / convert-save.py
Last active January 15, 2019 12:26
For a project - takes pics in a folder, resizes them and saves them into another folder
#!/usr/bin/env python3
#!/usr/bin/env python
"""
A script designed to
1) resize all of the downloaded images to desired dimension (DEFAULT 64x64 pixels) and
2) rename images in folders from 1.png to n.png for ease of use in training
Modified version from https://github.com/rkjones4/GANGogh/blob/master/misc/picStuff.py
"""
@jbdrvl
jbdrvl / cpuinfo.go
Last active January 12, 2019 15:10
Prints CPU(s) usage and updates it in real time by accessing the CPU info in /proc/stat
package main
import (
"os"
"log"
"bufio"
"strconv"
"strings"
"runtime"
"time"
@jbdrvl
jbdrvl / system-info.sh
Created January 9, 2019 19:09
Prints some information about the system: battery level, disk/mem/swap usage and CPU temperature
#!/usr/bin/env sh
# Jan 9, 2019
# Debian 4.17
echo Battery Status:
awk "BEGIN {printf \"%.1f%%\n\n\", 100*$(cat /sys/class/power_supply/BAT0/energy_now)/$(cat /sys/class/power_supply/BAT0/energy_full)}"
echo 'CPU Temperature (Celsius):'
echo "$(($(cat /sys/class/thermal/thermal_zone0/temp)/1000)) C\n"
@jbdrvl
jbdrvl / ip_addr.c
Created August 7, 2018 10:28
Prints all IPs found in PCAP file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
//#include <sys/socket.h>
//#include <netinet/in.h>
#include <arpa/inet.h>
//#include <netinet/if_ether.h>
@jbdrvl
jbdrvl / sha1.c
Created August 5, 2018 05:25
just returns the hash of argv[1]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/sha.h>
/*
* SHA1 Function
* Description: just returns the hash of argv[1]
* To compile: gcc -Wall sha1.c -o sha1 -lcrypto
*/
@jbdrvl
jbdrvl / finally.py
Created May 1, 2018 15:35
Test of the {<try>, <finally>} keywords.
#!/usr/bin/env python3
'''
Will loop infinitely until stopped by the user (ctrl+C).
When interrupted, the program will print "Leaving main!" before raising the <KeyboardInterrupt> exception.
Not very useful but I thought it was pretty cool.
'''
def main():
try:
@jbdrvl
jbdrvl / Makefile
Last active April 16, 2018 21:23
simple <clocks> presentation in C
all : main
main : main.o
gcc main.o -Wall -o main
main.o : main.c
gcc -W -Wall -c main.c -o main.o
run : main
rm main.o
@jbdrvl
jbdrvl / Makefile
Created April 15, 2018 18:51
simple threads presentation in C
all : threads
threads : test-threads.c
gcc -lpthread test-threads.c -o threads
run : threads
./threads
#!/usr/bin/env python3
import urllib.request, json
import sys
import datetime
args = sys.argv[1:]
dest=''
origine=''
while len(args)!=0: