View gist:04ce172943da0a1ff4f2fe0e2220adca
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
View twoline_prompt.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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\]" |
View group_android_res.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob, os | |
from shutil import copyfile | |
suffixes = [ | |
"xxxhdpi", | |
"xxhdpi", | |
"xhdpi", | |
"hdpi", | |
"mdpi", | |
] |
View hanoy_binary.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
View hanoy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
current_tower = 0 | |
target_axis = 2 | |
axises = [ | |
[6, 5, 4, 3, 2, 1], | |
[], | |
[] | |
] | |
def _select_axis(tower_index, axis): | |
axises_indexes = [0, 1, 2] |
View palette.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <vector> | |
#include <string> | |
#include <array> | |
#include <math.h> | |
// Палитры цветов | |
#include "palettes.h" |
NewerOlder