Skip to content

Instantly share code, notes, and snippets.

View autumnharmony's full-sized avatar
:octocat:
Github introduced status feature. Twitter is in danger

autumnharmony

:octocat:
Github introduced status feature. Twitter is in danger
View GitHub Profile
if (F1.Info == F2.Info){
#region если вхождение в самом начале
Debug.WriteLine("предположительно есть совпадение в начале");
p = F1;
pp = F2;
//Node t = p;
@autumnharmony
autumnharmony / Bit Flags
Created January 2, 2011 16:59
Битовые флаги C#
[Flags]
public enum AccessFlags{
NoAccess = 0x0,
ReadAccess = 0x1,
WriteAccess = 0x2,
ExecuteAccess = 0x4
}
#!/bin/bash
# Пример работы с VKAPI в shell-скрипте.
# Скрипт для работы с музыкой ВКонтакте. by snoopcatt.
_version="0.03a"
# Системные переменные
id="5807425" # системная переменная. ID создателя приложения. Взято из VK_Search Amarok Script (c)
method='audio.search' # метод поиска музыки ВКонтакте.
secret='dTckAoaSzH' # системная переменная. Секретный код приложения. Взято из VK_Search Amarok Script (c)
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ ./configure --with-curl
## --------- ##
## Platform. ##
@autumnharmony
autumnharmony / flac2mp3
Created August 3, 2011 15:30
flac -> mp3
#!/bin/bash
OUT_DIR="./mp3"
[ ! -d ${OUT_DIR} ] && mkdir -p ${OUT_DIR}
# modify the lame options to your
# preference
lame_opts=" --vbr-new -V 2 -B 256 "
for FLAC in *.flac;
do
MP3=`basename "${FLAC%.flac}.mp3"`
[ -r "$FLAC" ] || { echo can not read file \"$FLAC\" >&1 ; exit 1 ; } ;
@autumnharmony
autumnharmony / complex
Created September 10, 2011 08:58
pascal complex var operations
{complex var operations}
procedure cmul(a,b:complex; var c:complex);
begin
c.x := a.x * b.x - a.y * b.y;
c.y := a.x * b.y + b.x * a.y;
end;
procedure csum(a,b:complex; var c:complex);
begin
c.x := a.x + b.x;
@autumnharmony
autumnharmony / gist:1239254
Created September 24, 2011 12:08
Exceptions in C with Longjmp and Setjmp
#include <stdio.h>
#include <setjmp.h>
#define TRY do{ jmp_buf ex_buf__; if( !setjmp(ex_buf__) ){
#define CATCH } else {
#define ETRY } }while(0)
#define THROW longjmp(ex_buf__, 1)
int
main(int argc, char** argv)
@autumnharmony
autumnharmony / gist:4143296
Created November 25, 2012 12:20
split number and not numbers
expressionString.split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)");
@autumnharmony
autumnharmony / gist:4171172
Created November 29, 2012 19:08
Indexes of all occurrences of character in a string
for (int index = word.indexOf(guess);
index >= 0;
index = word.indexOf(guess, index + 1))
{
System.out.println(index);
}
import org.apache.xalan.processor.TransformerFactoryImpl;
import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
import org.jdom2.transform.JDOMResult;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;