Skip to content

Instantly share code, notes, and snippets.

View mosolovsa's full-sized avatar
🐈

Mosolov Sergey mosolovsa

🐈
View GitHub Profile
package main
import (
"syscall"
"unsafe"
"fmt"
"os"
"os/exec"
"path/filepath"
)
@mosolovsa
mosolovsa / gist:ecbc287a1820b15c7fbdb326ba09a11b
Created November 24, 2017 21:04
one dark theme for QtCreator
#start /home/serg/.config/QtProject/qtcreator/styles/onedark.xml
<?xml version="1.0" encoding="UTF-8"?>
<style-scheme version="1.0" name="onedark">
<style name="Text" foreground="#cecece" background="#282c34"/>
<style name="Link" foreground="#409090"/>
<style name="Selection" foreground="#ffffff" background="#4e4e8f"/>
<style name="LineNumber" foreground="#5c6370" background="#2f343f"/>
<style name="SearchResult" foreground="#000000" background="#2d4c95"/>
<style name="SearchScope" foreground="#000000" background="#f8fafc"/>
<style name="Parentheses" foreground="#ffff00" background="#4e4e8f"/>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <fcntl.h>
#include <malloc.h>
@mosolovsa
mosolovsa / main.cpp
Created November 6, 2020 09:12
noway for virtuals
#include <iostream>
template <typename T> constexpr
void print_type() {
std::cerr << __PRETTY_FUNCTION__ << std::endl;
}
enum ETypes {
type1,
type2
#include <iostream>
#include <memory>
#include <cxxabi.h> // <-- gcc header
template <typename type> std::unique_ptr<const char*> type_name(const type *addr)
{ return std::make_unique<const char *>(abi::__cxa_demangle(typeid(*addr).name(), 0, 0, NULL)); }
template<typename T> struct MyTest {
MyTest(T _data) : data(_data) { }
@mosolovsa
mosolovsa / main.dart
Created May 20, 2021 10:07
Custom flutter navigation widget
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
void main() {
runApp(StartupApplication());
}
enum Page { screenDashboard, screenProfile, screenSearch }
@mosolovsa
mosolovsa / main.py
Created July 1, 2021 22:06
manual duplex printing chunk generate
import os.path
from PyPDF2 import PdfFileReader, PdfFileWriter
# chunk_size, path = sys.argv[1], sys.argv[2]
chunk_size, path = 50, '/home/serg/print/auto/fluent.pdf' # '/home/serg/Documents/sicp.pdf'
pdf = PdfFileReader(str(path))
cnt = pdf.getNumPages()
ranges = [range(i, i+chunk_size) for i in range(0, cnt, chunk_size)]
sudo apt install autoconf build-essential bison flex git texinfo help2man gawk libtool libncurses5-dev python3-dev python3-distutils
git clone http://github.com/crosstool-ng/crosstool-ng
cd crosstool-ng
./bootstrap
./configure --enable-local
DEFCONFIG=samples/.../crosstool.config ./ct-ng defconfig
./ct-ng build
from PySide2.QtCore import QTimer, QObject, SIGNAL
from PySide2.QtGui import QResizeEvent
from PySide2.QtWidgets import QApplication, QWidget, QLabel, QMainWindow
from PySide2.QtSvg import QSvgWidget
import sys
class AppWindow(QMainWindow):
def __init__(self, parent=None):
super(AppWindow, self).__init__(parent)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.