Skip to content

Instantly share code, notes, and snippets.

View milabs's full-sized avatar
💭
CMake is SHIT

Ilya V. Matveychikov milabs

💭
CMake is SHIT
  • Russia, Moscow
View GitHub Profile
@milabs
milabs / gist:9001250
Created February 14, 2014 13:47
Git fails when pushing commit to github
Q: Git fails when pushing commit to github
A: git config --global http.postBuffer 524288000
$ man git config
http.postBuffer
Maximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system. For
requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a
massive pack file locally. Default is 1 MiB, which is sufficient for most requests
@milabs
milabs / gist:10930693
Created April 16, 2014 20:40
git format-patch & thunderbird
git format-patch --cover-letter --attach --stdout -2 --subject-prefix="..." --to=<...> | formail -ds >> $HOME/.thunderbird/k350j4w1.default/Mail/Local\ Folders/Drafts
@milabs
milabs / gist:9e45af1abf6d05a7b84d
Created September 24, 2014 07:13
How to prevent updating of a specific package?
# echo "chromium-browser hold" | sudo dpkg --set-selections
# dpkg --get-selections | grep chromium...
# echo "chromium-browser install" | sudo dpkg --set-selections
@milabs
milabs / gist:89b2ab783803c090163c
Created December 10, 2014 10:15
Where to get debug symbols for kernel X
Q: Where to get debug symbols for kernel X?
A: http://ddebs.ubuntu.com/pool/main/l/linux/
codename=$(lsb_release -c | awk '{print $2}')
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF
deb http://ddebs.ubuntu.com/ ${codename} main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-security main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted universe multiverse
/*
* memset_volatile is a volatile pointer to the memset function.
* You can call (*memset_volatile)(buf, val, len) or even
* memset_volatile(buf, val, len) just as you would call
* memset(buf, val, len), but the use of a volatile pointer
* guarantees that the compiler will not optimise the call away.
*/
void * (* volatile memset_volatile)(void *, int, size_t) = memset;
@milabs
milabs / gist:c2c71b410bb725ea7a5a
Created November 17, 2015 13:06
Using URI::Fetch cached
use URI::Fetch;
use Cache::File;
use HTTP::Status qw(:constants);
$url = 'http://127.0.0.1:8080/media/snapshot.json.gz';
$cache = Cache::File->new(cache_root => '/tmp/cache');
$response = URI::Fetch->fetch($url, ForceResponse => 1, Cache => $cache);
if ($response->http_status == HTTP_OK) {
@milabs
milabs / TRObject.cpp
Created December 2, 2015 11:46
TRObject - QVariant-based property tree
#include "TRObject.h"
TRObject& TRObject::operator[](const QString& key)
{
if (type() == QVariant::Map)
return keyValue<QVariantMap>(this, key);
else if (type() == QVariant::Hash)
return keyValue<QVariantHash>(this, key);
setValue(QVariantMap());
@milabs
milabs / gist:84224927368dd751205e
Created December 6, 2015 16:33
Wrapper for ffplay to watch RTSP disconnection without TEARDOWN
#!/usr/bin/perl -w
use strict;
no warnings 'once';
my $cmd = "ffplay -nodisp -loglevel info rtsp://SERVER/live";
pipe( READER, WRITER ) ;
my $child = open READER, '-|';
@milabs
milabs / gist:6467676
Created September 6, 2013 18:12
git - rename branch (local and remote)
#rename local branch
git branch -m old-branch-name new-branch-name
#delete remote branch with old name
git push origin :old-branch-name
#create remote renamed branch
git push origin new-branch-name
@milabs
milabs / gist:7820818
Created December 6, 2013 09:11
CPU usage statistics with SAR
sar -u 1 | grep --line-buffered all | awk -W interactive '{printf("%s %s\n", $1, $5);}'