Skip to content

Instantly share code, notes, and snippets.

View agudulin's full-sized avatar
🦦

sasha gudulin agudulin

🦦
View GitHub Profile
@agudulin
agudulin / gist:1934735
Created February 28, 2012 19:58
Bison: python code parser
%{
#include <string>
#include <iostream>
using namespace std;
#define DEBUG
#define YYSTYPE string
string className = "";
@agudulin
agudulin / gist:1934741
Created February 28, 2012 19:59
Flex: lexer for python code
%{
#include <string>
#include <iostream>
using namespace std;
#define YYSTYPE string
#include "pyparser.tab.h"
%}
@agudulin
agudulin / pyparser.y
Created March 22, 2012 13:22
Bison: grammar (python parser)
%{
#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
#define YYSTYPE string
#define YYERROR_VERBOSE 1
#define DEBUG
@agudulin
agudulin / lexer.l
Created March 22, 2012 13:27
Flex: grammar (python parser)
%{
#include <string>
#include <iostream>
using namespace std;
#define YYSTYPE string
#include "pyparser.tab.h"
%}
@agudulin
agudulin / house.bf
Created June 11, 2012 16:31
Brainfuck: The first experience
*
* * The First BrainFuck Experience
* * ==============================
* * Tried to build house
* * But
********* Stopped at this place
* *
* *
* *
* *
@agudulin
agudulin / gist:2942039
Created June 16, 2012 17:33
Python: Looking for the most beautiful girl in vk.com/girlsview
import vkontakte
import json
import sqlite3
import time
from pprint import pprint
def fill_db(db_name):
conn = sqlite3.connect(db_name)
c = conn.cursor()
@agudulin
agudulin / hw_ok.sh
Created October 16, 2012 22:21
Bash: Homework OK
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Error!";
else
for arg in $@; do
if [ $arg == "name" ]; then
echo `whoami`;
elif [ $arg == "time" ]; then
echo `date +"%S:%M:%H %m.%d.%Y"`;
@agudulin
agudulin / hw_fail.sh
Created October 16, 2012 22:23
Bash: Homework FAIL
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Error!";
else
for arg in $@; do
if [ $arg == "name" ]; then
echo "yaska";
elif [ $arg == "time" ]; then
echo `date +"%S:%M:%H %m.%d.%Y"`;
@agudulin
agudulin / test_hw.pl
Created October 16, 2012 22:23
Perl: Homework TEST SYSTEM
#!/usr/bin/perl
use Switch;
use strict;
use warnings;
if ($#ARGV eq -1) {
print "Error! No script to test.\n";
print "Usage:\n check_hw.pl [script_to_test.pl]\n";
exit(0);
}
@agudulin
agudulin / convert_subtitles.sh
Created October 18, 2012 02:49
Bash: convert subtitles files into unicode
#!/bin/bash
# Usage:
# copy this script into the folder with subtitles files
#
# chmod +x convert_subtitles.sh
# ./convert_subtitles.sh *.srt
backup="backup_cp1251_srt/";