Skip to content

Instantly share code, notes, and snippets.

View oz123's full-sized avatar
🎯
Focusing

Oz Tiram oz123

🎯
Focusing
View GitHub Profile
@oz123
oz123 / rppy.py
Last active December 24, 2015 12:19
Rppy - my little script to enjoy Radio Paradise. The script uses mplayer to play and libnotify to send messages with the song information to the desktop notification area. I tested it on Debian and Mate-Desktop
s
@oz123
oz123 / jessie.preseed
Last active January 11, 2020 22:57 — forked from sturadnidge/wheezy.preseed
working preseed for debian testing
###
#
# Preseed for a Debian based machine on kvm
#
# Boot this file with: press TAB on the installer
# add the following to the boot parameters:
#
# install keymap=en_US locale=en_US netcfg/get_hostname=testserve \
# netcfg/get_domain=carfax.eu preseed/url=http://192.168.XXX.XXX:8000/wheezy.preseed
#
/* Test for hanged mounts */
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>
@oz123
oz123 / regex_example.c
Created December 1, 2014 08:34
A reminder to self on how to use regex in c
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]){
regex_t regex;
int reti;
char msgbuf[100];
size_t max_groups = 1;
@oz123
oz123 / ephoc2gmt.c
Created December 2, 2014 08:29
A small reminder to self how to convert seconds since the epoch to GM time.
#define _XOPEN_SOURCE
#include <string.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
// in main()
int
@oz123
oz123 / Cronjob_and_Explanation
Created December 2, 2014 15:55
I was ask to collect all logs from different host to a central place. I was also asked to implement this with rsync. So here is what I came up with:
cronjob:
========
* 1 * * * rsync -e 'ssh -v -i .ssh/log_coll_id_rsa logcol@server' -aP /var/log/mongodb/*.s server:.
### There results:
On the server called server you will see in the home directory of the ssh user you created a directory with the log files for each host
you installed the ssh key, the script and the cron job.
ls ~
@oz123
oz123 / test_number.c
Created December 3, 2014 22:50
Detect if a string is an integer or a double number
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int main(int argc, char *argv[])
{
char* to_convert = argv[1];
char* p = NULL;
@oz123
oz123 / array_pass_by_ref.c
Created December 11, 2014 13:55
Modify arrays inside functions in C. This subject is always tricky and I tend to forget, so here is a not to self.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
/* demonstrate pass by reference of an array of integers*/
void resize( int **p, int size ) {
free( *p );
*p = (int*) malloc( size * sizeof(int) );
int tocpy[]= {8};
@oz123
oz123 / array_access
Created December 11, 2014 23:10
accessing array elements ...
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
/* demonstrate pass by reference of an array of integers*/
void resize( int **p, int size ) {
free( *p );
*p = (int*) malloc( size * sizeof(int) );
int tocpy[]= {8};
@oz123
oz123 / build_if_new_version.sh
Last active August 29, 2015 14:13
Build sphinx docs from multiple branches on change - kind of like read the docs for the poor
#!/bin/sh
CONFIG_FILE=$1
source $CONFIG_FILE
cd $PROJECT_DIR
export PATH=/usr/local/bin:$PATH