Skip to content

Instantly share code, notes, and snippets.

View microo8's full-sized avatar

Vlαdo Magyar microo8

View GitHub Profile
@microo8
microo8 / append_path.go
Created April 2, 2019 07:30
Append PATH on windows in Go
package main
import (
"fmt"
"log"
"os"
"syscall"
"unsafe"
"golang.org/x/sys/windows/registry"
@microo8
microo8 / helloservice.go
Last active April 8, 2017 11:31
helloservice
package helloservice
//HelloService is the Service with its public API
type HelloService struct {
HelloEndpoint chan *HelloReq //Endpoint on which the service listens
}
//NewHelloService returns a new Service
func NewHelloService() *HelloService {
return &HelloService{
@microo8
microo8 / gitmost.sh
Created April 4, 2017 04:49
snipet to create an alias that will print out 10 most edited files in an git repository
alias gitmost="git log --since=\"120 days ago\" --pretty=format:\"\" --name-only | grep \"[^\s]\" | sort | uniq -c | sort -nr | head -10"
@microo8
microo8 / chromecookies.go
Created September 21, 2016 09:48
Gets and decrypts chrome cookies on linux
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/sha1"
"database/sql"
"log"
"net/http"
"os/user"
@microo8
microo8 / gssapi-client.c
Created June 6, 2016 07:51 — forked from cbusbey/gssapi-client.c
GSSAPI "house"
// The GSSAPI security mechanism
#include <czmq.h>
#include <zmq.h>
void zsocket_set_gssapi_client(void * zocket)
{
int rc = zmq_setsockopt (zocket, ZMQ_GSSAPI_SERVICE_PRINCIPAL, "host", 4);
assert (rc == 0 || zmq_errno () == ETERM);
@microo8
microo8 / Win32Service.c
Created April 20, 2016 07:39
Win32Service for cx_freeze in Python3
//-----------------------------------------------------------------------------
// Win32Service.c -- edited for python3
// cx_freeze Base executable for handling Windows services.
// BEFORE INSTALL: in setup.py you must edit line (170):
//
// if moduleInfo is not None and sys.version_info[:2] < (3, 0):
// to
// if moduleInfo is not None:
//-----------------------------------------------------------------------------
@microo8
microo8 / uuid_mac_time.sql
Last active September 23, 2019 09:13
PostgreSQL - getting mac address and timestamp from uuid type generated from uuid_generate_v1() in uuid-ossp extension
CREATE OR REPLACE FUNCTION uuid_macaddr(id uuid)
RETURNS macaddr AS
$BODY$
select substring(id::text, 25, 12)::macaddr
$BODY$
LANGUAGE sql IMMUTABLE STRICT
COST 100;
CREATE OR REPLACE FUNCTION uuid_timestamp(id uuid)
RETURNS timestamp with time zone AS
@microo8
microo8 / pca.h
Created November 13, 2012 13:10
PCA procedure in C using GSL
#include <assert.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_statistics.h>
#include <gsl/gsl_eigen.h>
#include <gsl/gsl_blas.h>
gsl_matrix* pca(const gsl_matrix* data, unsigned int L)
{
/*
@param data - matrix of data vectors, MxN matrix, each column is a data vector, M - dimension, N - data vector count