Skip to content

Instantly share code, notes, and snippets.

Avatar

stavros vagionitis svagionitis

View GitHub Profile
@svagionitis
svagionitis / stash-get-clone-repos.sh
Created Oct 27, 2016
Clone repositories for projects in Stash
View stash-get-clone-repos.sh
#!/bin/sh
JQ="`which jq` -r"
CURL="`which curl` -s"
BASENAME="`which basename`"
GIT="`which git`"
STASH_SERVER=""
STASH_PROJECTS="${STASH_SERVER}/rest/api/1.0/projects"
@svagionitis
svagionitis / bitbucket-clone-user-repos.sh
Last active Jul 10, 2017
Clone a user repos from bitbucket using it's REST API
View bitbucket-clone-user-repos.sh
#!/bin/bash -ex
BITBUCKET_SERVER_API="https://api.bitbucket.org"
USER_REPOSITORIES="${BITBUCKET_SERVER_API}/1.0/user/repositories"
# Utilites to be used
CURL="`which curl` -s"
JQ="`which jq`"
GIT="`which git`"
@svagionitis
svagionitis / fix_pem.c
Last active Sep 27, 2020
Fix certificates in PEM format which don't have newlines
View fix_pem.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#define PEM_CERTIFICATE_HEADER "-----BEGIN CERTIFICATE-----"
@svagionitis
svagionitis / ssha.c
Last active Sep 27, 2020
SSHA encoding and decoding (bruteforce)
View ssha.c
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <ctype.h>
#include <openssl/rand.h>
#include <openssl/sha.h>
#define NUM_SALT_BYTES 8
#define SHA1_LENGTH 20
View gist:489472062a3718899f80a921fcc74c17
/* ========================================================================
$File: tools/ctime/ctime.c $
$Date: 2016/05/08 04:16:55PM $
$Revision: 7 $
$Creator: Casey Muratori $
$Notice:
The author of this software MAKES NO WARRANTY as to the RELIABILITY,
SUITABILITY, or USABILITY of this software. USE IT AT YOUR OWN RISK.
@svagionitis
svagionitis / curl_multi_test.c
Created May 4, 2016 — forked from clemensg/curl_multi_test.c
libcurl multi interface example
View curl_multi_test.c
/* curl_multi_test.c
Clemens Gruber, 2013
<clemens.gruber@pqgruber.com>
Code description:
Requests 4 Web pages via the CURL multi interface
and checks if the HTTP status code is 200.
Update: Fixed! The check for !numfds was the problem.
@svagionitis
svagionitis / .git-commit-template.txt
Created Mar 12, 2016 — forked from adeekshith/.git-commit-template.txt
A Git commit template to make it easy to enforce a good and uniform commit message style across teams.
View .git-commit-template.txt
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@svagionitis
svagionitis / curltest.c
Last active Sep 27, 2020 — forked from leprechau/curltest.c
example code using libcurl and json-c to post and parse a return from http://jsonplaceholder.typicode.com
View curltest.c
/**
* example C code using libcurl and json-c
* to post and return a payload using
* http://jsonplaceholder.typicode.com
*
* Requirements:
*
* json-c - https://github.com/json-c/json-c
* libcurl - http://curl.haxx.se/libcurl/c
*
@svagionitis
svagionitis / Makefile
Created Feb 4, 2016
Generate a random string which will be used as a UUID.
View Makefile
all: rand_uuid
rand_uuid: rand_uuid.c
gcc -o rand_uuid -O2 -Wall -W -ansi -pedantic -std=gnu99 rand_uuid.c
clean:
rm -rf rand_uuid
@svagionitis
svagionitis / PythonClassAssignSetter.sh
Created Nov 25, 2015
Read a python class and extract the attributes from the constructor
View PythonClassAssignSetter.sh
#!/bin/sh -ex
# Read an python class file and extraact the attributes
# from the constructor. Then assign them and creates setters
PYTHON_CLASS_FILE=${1}
get_constructor_definition=$(sed -n '/__init__(self,/,/):/p' ${PYTHON_CLASS_FILE} | tr -s ' ')
get_mandatory_attributes=$(echo ${get_constructor_definition} | sed 's/def\|__init__\|self//g' | sed 's/, /\n/g' | tr -d ' (,):' | grep -v '=None')
get_optional_attributes=$(echo ${get_constructor_definition} | sed 's/def\|__init__\|self//g' | sed 's/, /\n/g' | tr -d ' (,):' | grep '=None' | cut -d '=' -f 1)