Skip to content

Instantly share code, notes, and snippets.

Avatar
🏖️
Bali

Andrey Kabylin sysint64

🏖️
Bali
View GitHub Profile
View gist:04ce172943da0a1ff4f2fe0e2220adca
#!/usr/bin/env python
import argparse
import requests
import sys
parser = argparse.ArgumentParser(description='Github statuses api helper.')
parser.add_argument('--owner', type=str, help="a repository owner", required=True)
parser.add_argument('--repo', type=str, help="repository name", required=True)
View linked_list.c
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
struct Node {
int data;
struct Node* next;
struct Node* prev;
} typedef Node;
View placholder_hightlight.java
public String getPlaceholderText(@NotNull final ASTNode node) {
...
if (psi instanceof DLanguageBlockStatement) {
final DLanguageBlockStatement block = (DLanguageBlockStatement) psi;
final PsiElement inner = getInnerStatementBlockForDisplayInPlaceholder(block);
if (inner != null) {
return "{ " + inner.getText().trim() + " }";
} else {
View example_ui_view.d
class MyView : View {
@ViewWidget Button okButton;
@ViewWidget Panel testPanel;
@ViewWidget("cancelButton") Button myButton;
@GroupViewWidgets Button[3] buttons;
int a = 0;
this(Manager manager, in string laytoutFileName, in string shortcutsFileName) {
super(manager, laytoutFileName, shortcutsFileName);
@sysint64
sysint64 / twoline_prompt.sh
Created May 13, 2017 11:07 — forked from mkottman/twoline_prompt.sh
A two-line colored Bash prompt (PS1) with Git branch and a line decoration which adjusts automatically to the width of the terminal. Recognizes SVN, Git and Fossil version control systems and shows the current branch/revision.
View twoline_prompt.sh
# A two-line colored Bash prompt (PS1) with Git branch and a line decoration
# which adjusts automatically to the width of the terminal.
# Recognizes and shows Git, SVN and Fossil branch/revision.
# Screenshot: http://img194.imageshack.us/img194/2154/twolineprompt.png
# Michal Kottman, 2012
RESET="\[\033[0m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
@sysint64
sysint64 / group_android_res.py
Created March 1, 2017 06:39
copy android files with suffixes hdpi, mdpi etc. to folders minimap-hdpi, minimap-mdpi etc. without suffixes.
View group_android_res.py
import glob, os
from shutil import copyfile
suffixes = [
"xxxhdpi",
"xxhdpi",
"xhdpi",
"hdpi",
"mdpi",
]
View hanoy_binary.py
def restore_disks(size, action_index, action_count, from_axis, to_axis):
pivot = action_count // 2
free_axis = _select_axis(from_axis, to_axis)
part_count = action_count - pivot - 1
if action_index == pivot:
axises[from_axis].append(size)
for i in range(size-1, 0, -1):
axises[free_axis].append(i)
@sysint64
sysint64 / hanoy.py
Last active December 1, 2016 16:21
View hanoy.py
current_tower = 0
target_axis = 2
axises = [
[6, 5, 4, 3, 2, 1],
[],
[]
]
def _select_axis(tower_index, axis):
axises_indexes = [0, 1, 2]
@sysint64
sysint64 / palette.h
Created May 25, 2016 17:47
Палитра 4 битная и 8 битная
View palette.h
#pragma once
uint8_t RGB4_Palette[][3] = {
{ 0 , 0 , 0 }, // Black
{ 255, 255, 255 }, // White
{ 255, 0 , 0 }, // Red
{ 0 , 255, 0 }, // Lime
{ 0 , 0 , 255 }, // Blue
{ 255, 255, 0 }, // Yellow
{ 0 , 255, 255 }, // Cyan / Aqua
View bmp_palette_simplify.cpp
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <array>
#include <math.h>
// Палитры цветов
#include "palettes.h"