Skip to content

Instantly share code, notes, and snippets.

View kafeg's full-sized avatar
💭
In C++ we trust!

Vitaly kafeg

💭
In C++ we trust!
View GitHub Profile
@egorsmkv
egorsmkv / metrials-go.md
Last active May 23, 2024 17:04
Материалы по Go (golang): мануалы, статьи, книги и ссылки на сообщества

Материалы по Go (golang)

На русском языке

Мануалы и туториалы

  • [Введение в программирование на Go][1]
  • [Маленькая книга о Go][3]
  • [Эффективный Go][2]
  • Есть еще [Краткий пересказ Effective Go на русском языке][4], но 2009 года
@harlow
harlow / cache.go
Created August 24, 2016 18:23
Golang cache map
package cache
import (
"crypto/sha256"
"encoding/json"
"fmt"
"os"
"sync"
"time"
)
@nekdenis
nekdenis / gist:60a160a5a3503f0dbdd1a0a429aa8794
Created July 19, 2016 14:57
TeamCity script git changes. Script that loads commit messages of last changes
#!/bin/bash
# Where the changelog file will be created
outputFile='%system.teamcity.build.tempDir%/releasenotesfile_%teamcity.build.id%.txt'
# the url of teamcity server
teamcityUrl='%teamcity.serverUrl%'
# username to access Teamcity REST API
username='%system.teamcity.auth.userId%'
# password to access Teamcity REST API
password='%system.teamcity.auth.password%'
@rrafal
rrafal / sqlx_json.go
Created March 31, 2016 00:02
Use JSON field with golang sqlx driver
package main
import (
"encoding/json"
"errors"
"database/sql/driver"
"fmt"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
"log"
@maxim
maxim / gh-dl-release
Last active May 21, 2024 05:55
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@luckydonald
luckydonald / cubietruck_wifi_bridge.md
Last active March 15, 2021 15:39
How I configure the Cubietruck to work as an WLAN bridge.

In this file I document the steps taken to get the onboard wifi chip of the Cubietruck (Cubieboard 3) up and running.

Add the wifi driver to the modules to load on startup.

sudo nano /etc/modules

Now add at the end of the file, if not already in the list:

bcmdhd
@seansawyer
seansawyer / hex_to_bit_varying.sql
Last active February 2, 2017 09:40
PL/pgSQL function to convert a hexadecimal string to a bit varying
DROP FUNCTION IF EXISTS hex_to_bit_varying(hex_string text);
CREATE FUNCTION hex_to_bit_varying(hex_string text) RETURNS bit varying AS $$
DECLARE
bytes bytea = decode(hex_string, 'hex');
n int = length(bytes) * 8 - 1;
bits bit varying := B''::bit varying;
BEGIN
-- RAISE NOTICE 'bytes=%, n=%', bytes, n;
-- RAISE NOTICE 'bits=%', bits;
FOR i IN 0 .. n BY 8 LOOP
@kblomqvist
kblomqvist / githook-astyle.sh
Last active September 9, 2022 13:04
Git pre-commit hook to check C/C++ source file format using astyle (Artistic Style)
#!/bin/bash
# Installation:
# cd my_gitproject
# wget -O pre-commit.sh http://tinyurl.com/mkovs45
# ln -s ../../pre-commit.sh .git/hooks/pre-commit
# chmod +x pre-commit.sh
OPTIONS="-A8 -t8 --lineend=linux"
RETURN=0
@jbache
jbache / NavigationDrawer.qml
Created December 1, 2014 15:02
Qt Quick Navigation Drawer
/*
Copyright (c) 2014 Cutehacks A/S
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@azadkuh
azadkuh / qt-unix-signals.md
Last active April 16, 2024 12:50
Catch Unix signals in Qt applications

Unix signals in Qt applications

It's quite easy to catch unix signals in Qt applications. you may like to ignore or accept them.

#include <QCoreApplication>

#include <initializer_list>
#include <signal.h>
#include <unistd.h>