This file contains hidden or 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
// http://blog.sandwormz.com/2010/11/rolling-counter-algorithm-pattern.html | |
class Scratch { | |
public static void main(String[] args) { | |
convertPennies(150); | |
} | |
public static String[] labels = {"Nickles", "Dimes", "Quarters", "Dollars"}; | |
public static int[] units = {5, 10, 25, 100}; | |
public static void convertPennies(int pennies) { |
This file contains hidden or 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
// Скрипт ходит по страницам и делает скриншоты div'а | |
// Установка: `npm install puppeteer` | |
// Запуск: `nodejs screenshot.js` | |
// | |
// После работы в директории будет набор файлов 001.png 002.png ... итд | |
// Чтобы их сконвертировать в pdf, можно воспользоваться imagemagick | |
// | |
// # Установить imagemagick | |
// sudo apt-get install imagemagick | |
// |
This file contains hidden or 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
namespace | |
{ | |
inline std::size_t | |
unaligned_load(const char* p) | |
{ | |
std::size_t result; | |
__builtin_memcpy(&result, p, sizeof(result)); | |
return result; | |
} |
This file contains hidden or 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
/* Точки под Windows 9x/NT/ME/2000/XP */ | |
/* Copyright (c) 2004 by Zealot [WB Team] */ | |
#include <windows.h> | |
#pragma hdrstop | |
#include "points.h" | |
HDC hdc; | |
PAINTSTRUCT ps; | |
HPEN hpen; | |
HBRUSH hbrush; |
This file contains hidden or 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
-- После запуска unity-settings-daemon нужно некоторое время подождать, прежде чем | |
-- менять настройки клавиатуры, иначе unity-settings-daemon может поменять их обратно | |
-- Наверное, можно как-то по логам демона понять, что он запустился, но пока сделал по-простому | |
os.execute("pgrep unity-settings-daemon || unity-settings-daemon&") | |
os.execute("sleep 1.5") | |
os.execute("setxkbmap -layout \'\' -option") | |
os.execute("setxkbmap -layout \'us,ru\' -option \'grp:ctrl_shift_toggle\'") | |
os.execute("setxkbmap -option compose:ralt") |
This file contains hidden or 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
# Bug https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1683383 | |
# Original article https://habrahabr.ru/post/87408/ | |
# create directory | |
mkdir xorg-server | |
cd xorg-server | |
# get sources of required package | |
# may be need to uncomment 'deb-src' lines in sources.list before | |
apt-get source xserver-xorg-core-hwe-16.04 |
This file contains hidden or 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
FROM ubuntu:14.04 | |
RUN apt-get update && apt-get install -y wget unzip | |
RUN wget https://downloads.sourceforge.net/project/keepass/KeePass%202.x/2.36/KeePass-2.36.zip | |
RUN unzip -d /KeePass KeePass-2.36.zip | |
# xdotool allows KeePass to initiate autoinput (when you press Ctrl+V) | |
RUN apt-get update && apt-get install -y mono-complete xdotool | |
WORKDIR /KeePass/ |
This file contains hidden or 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
package ru.yandex; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
/** | |
* @author elwood | |
*/ | |
public class Raid { |
This file contains hidden or 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
buildscript { | |
ext.kotlinVersion = '1.0.4' | |
ext.kotlinSupportJdk8Version = '0.3' | |
ext.jacksonVersion="2.7.4" | |
repositories { | |
mavenCentral() | |
} | |
dependencies { |
This file contains hidden or 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
Взять выбранный файле из stash: | |
git checkout stash@{0} -- <file> | |
К сожалению, применить все файлы сразу нельзя. А еще чекаут просто заменяет файл на тот, который был в stash. Чтобы применить изменения в виде "патча", надо использовать команду apply: | |
git stash apply | |
Алиас команды для добавления в stage только новых файлов (не modified и не deleted): |
NewerOlder