Skip to content

Instantly share code, notes, and snippets.

View alopatindev's full-sized avatar

Alexander Lopatin alopatindev

View GitHub Profile
@alopatindev
alopatindev / smart_pointers_tree.cpp
Last active March 17, 2016 19:35
shared_ptr to this and other magic
#include <iostream>
#include <memory>
#include <stack>
#include <string>
#include <utility>
#include <vector>
template <typename T>
class Node : public std::enable_shared_from_this<Node<T>> {
const T data;
@alopatindev
alopatindev / array_wut.py
Created March 20, 2016 15:43
array_wut.py
class A:
x = 1
a = A()
b = A()
a.x += 1
print (a.x, b.x) # 1 2
class B:
x = []
@alopatindev
alopatindev / chromium-anon-proxy.sh
Created March 23, 2016 11:52
chromium-anon-proxy.sh
#!/bin/bash
CDIR="/tmp/chromium-cache-anon-proxy-${USER}"
DDIR="${HOME}/.config/chromium-anon-proxy"
mkdir -p ${CDIR} ${DDIR}
chromium --incognito --proxy-server=socks5://127.0.0.1:9050 --disk-cache-dir=${CDIR} --user-data-dir=${DDIR} $@
@alopatindev
alopatindev / android_emulator.sh
Last active April 14, 2016 02:47
android_emulator.sh
#!/bin/bash
TARGET='android-18'
NAME='android'
RECREATE=1
APATH=$ANDROID_SDK/tools/android
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ANDROID_SDK}/tools/lib64"
[ ${RECREATE} = 1 ] && (
This file has been truncated, but you can view the full file.
./support/android/apk/libs/armeabi/libmain.so: file format elf32-littlearm
DYNAMIC SYMBOL TABLE:
00000000 DF *UND* 00000000 __cxa_finalize
00000000 DF *UND* 00000000 __cxa_atexit
00000000 DF *UND* 00000000 ALooper_pollAll
03dfc930 g DF .text 00000024 _Unwind_Resume
04674618 g DO .data.rel.ro 00000008 _ZN101_$LT$compositor..IOCompositor$LT$Window$GT$$u20$as$u20$compositor_thread..CompositorEventListener$GT$20title_for_main_frame15__STATIC_FMTSTR17h299a6ec8b3595ebaE
04674604 g DO .data.rel.ro 00000014 _ZN101_$LT$compositor..IOCompositor$LT$Window$GT$$u20$as$u20$compositor_thread..CompositorEventListener$GT$20title_for_main_frame4_LOC17hac2ebc7a1797d0c1E
This file has been truncated, but you can view the full file.
./support/android/apk/libs/armeabi/libmain.so: file format elf32-littlearm
DYNAMIC SYMBOL TABLE:
00000000 DF *UND* 00000000 __cxa_finalize
00000000 DF *UND* 00000000 __cxa_atexit
021ddfa4 g DF .text 00000024 _Unwind_Resume
028228ac g DO .data.rel.ro 00000008 _ZN101_$LT$compositor..IOCompositor$LT$Window$GT$$u20$as$u20$compositor_thread..CompositorEventListener$GT$20title_for_main_frame15__STATIC_FMTSTR17h1f3abecc80102320E
02822898 g DO .data.rel.ro 00000014 _ZN101_$LT$compositor..IOCompositor$LT$Window$GT$$u20$as$u20$compositor_thread..CompositorEventListener$GT$20title_for_main_frame4_LOC17h35f08431fe492b2bE
00ab5bc8 g DF .text 000015c4 _ZN10env_logger4init17h49b0d5078ddf2a01E
@alopatindev
alopatindev / remove_all_spaces.c
Last active June 7, 2016 11:23
Remove all spaces
// cc -std=c99 -g -O0 -Wall remove_all_spaces.c -o remove_all_spaces && gdb -ex r -ex q ./remove_all_spaces
// cc -DENABLE_BENCHMARK -std=c99 -O3 -Wall remove_all_spaces.c -o remove_all_spaces && ./remove_all_spaces | gnuplot -p -
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@alopatindev
alopatindev / TextView.html
Last active July 3, 2016 14:34
QDeviceMonitor: possible solution for memory leak and performance issues
<!DOCTYPE html>
<html>
<head>
<script>
var colors = {};
var elementsPerLine = 8;
function createSpanElement (color, text) {
var element = document.createElement('span');
element.setAttribute('style', 'color:' + color);
warning: file found to be present in multiple build targets: /tmp/quickcheck/quickcheck_macros/examples/attribute.rswarning: file found to be present in multiple build targets: /tmp/quickcheck/quickcheck_macros/examples/attribute.rs
Updating registry `https://github.com/rust-lang/crates.io-index`
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling regex-syntax v0.3.4
Compiling regex-syntax v0.3.4
Compiling winapi Compiling winapi v0.2.8 v0.2.8
Compiling Compiling log v0.log v0.3.3.6
6
@alopatindev
alopatindev / .gdbinit
Last active October 12, 2016 20:32
~/.gdbinit enables colors; requires colout
set height 0
set pagination off
set disassembly-flavor intel
# Don't wrap line or the coloring regexp won't work.
set width 0
# Create a named pipe to get outputs from gdb
shell test -e /tmp/coloutPipe && rm /tmp/coloutPipe
shell mkfifo /tmp/coloutPipe