Skip to content

Instantly share code, notes, and snippets.

@CDanU
CDanU / CombineTelegramBackup.sh
Last active August 6, 2023 01:13
Combine all messages.*.html files into one, uses pup to extract html elements
#!/bin/bash
HTML_SELECTOR=".message"
for FILE in $(ls -1v messages*); do
cat ${FILE} | pup ${HTML_SELECTOR} >> data.html;
done
DATA=$(cat data.html); eval "cat <<EOF
$(<template.html)
/* -------------------------------------------------------------------------- */
/*
* Description: Makes the activity stream page look decent with the dark theme.
*
* Screenshot: https://imgur.com/a/WcxGk
*
* Contributor(s): Andrei Cristian Petcu
*/
.browserContainer {
[user]
email =
name =
logallrefupdates = true
[color]
ui = auto
status = auto
branch = auto
interactive = auto
@CDanU
CDanU / git-add--interactive-regexMOD.pl
Created June 10, 2017 22:43
Adds all splitted hunks of a file that match the REGEX specified by the '/' option
#!/usr/bin/perl
use 5.008;
use strict;
use warnings;
use Git;
use Git::I18N;
binmode(STDOUT, ":raw");
@CDanU
CDanU / post-commit
Last active May 20, 2017 19:09
Uncrustify Hooks
#!/bin/sh
# ------------------------------------------------------------------------------
# GPLv2
# Copyright (c) 2017, Daniel Chumak
# All rights reserved.
# ------------------------------------------------------------------------------
post="`pwd`/.uncr_5ca35"
#!/bin/python
from __future__ import print_function # python >= 2.6
import glob
from os import chdir, listdir, makedirs, path, name as os_name, \
linesep as os_linesep, sep as os_sep
from subprocess import Popen, PIPE, call
from sys import exit as sys_exit, stderr
from pprint import pprint
from threading import Timer
.... % cat ./src/compile_commands.json && clang-tidy -checks="-*, modernize-use-nullptr" -header-filter="./src/*" ./src/align.cpp && clang -v && clang-tidy -version
[
{
"directory": "..../uncrustify/build",
"command": "/usr/bin/c++ -DDEBUG -I..../uncrustify/build -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -std=gnu++0x -o CMakeFiles/uncrustify.dir/src/align.cpp.o -c ..../uncrustify/src/align.cpp",
"file": "..../uncrustify/src/align.cpp"
},
{
"directory": "..../uncrustify/build",
"command": "/usr/bin/c++ -DDEBUG -I..../uncrustify/build -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -std=gnu++0x -o CMakeFiles/uncrustify.dir/src/align_stack.cpp.o -c ..../uncrustify/src/align_stack.cpp",
@CDanU
CDanU / g_0
Last active February 14, 2017 23:06
unc-1008
class Foo
{
public:
template< class T >
operator T*() const
{
return 0;
}
template< class T >
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Uncrustify 0.64_d
nl_before_func_body_def = 2
# option(s) with 'not default' value: 1
#
# -=====-
# Line Tag Parent Columns Br/Lvl/pp Flag Nl Text
# 1> COMMENT_CPP[ COMMENT_WHOLE][ 1/ 1/ 62/ 0][0/0/0][ 0][0-0] // unc_add_option("sp_cond_colon", UO_sp_cond_colon, AT_IARF,
# 1> NEWLINE[ NONE][ 62/ 62/ 1/ 0][0/0/0][ 0][1-0]
# 2> COMMENT_CPP[ COMMENT_WHOLE][ 1/ 1/ 72/ 0][0/0/0][ 0][0-0] // "Add or remove space around the ':' in 'b ? t : f'");
# 2> NEWLINE[ NONE][ 72/ 72/ 1/ 0][0/0/0][ 0][1-0]