Skip to content

Instantly share code, notes, and snippets.

View vladimirgamalyan's full-sized avatar
👽
work for mood

Vladimir Gamalyan vladimirgamalyan

👽
work for mood
  • Yerevan, Armenia
View GitHub Profile
@vladimirgamalyan
vladimirgamalyan / mccmnc.py
Last active June 5, 2017 09:02
grab mcc/mnc from wiki to json
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import json
import re
def add_operator(mcc, mnc, brand, operator, status, country, country_code, db):
@vladimirgamalyan
vladimirgamalyan / unpacker.py
Created June 28, 2015 08:37
unpack TexturePacker .plist spritesheets
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import fnmatch
import plistlib
from PIL import Image
@vladimirgamalyan
vladimirgamalyan / bmfont_unpacker.py
Created July 13, 2015 12:48
unpack bmfont texture
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from PIL import Image
import xml.etree.ElementTree as ElementTree
def unpack_fnt(f):
@vladimirgamalyan
vladimirgamalyan / slicer.py
Created July 21, 2015 09:28
Slice image to hor/ver parts.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from PIL import Image
def slice_pic(src_file, cols, rows):
base_dir = os.path.dirname(os.path.abspath(src_file))
@vladimirgamalyan
vladimirgamalyan / xuk_ru_loader.py
Created July 23, 2015 11:30
Grab fresh photos from xuk.ru
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
from ghost import Ghost
import logging
import urllib
import os
@vladimirgamalyan
vladimirgamalyan / header.snippet
Created July 27, 2015 11:16
Visual Studio header file with class declaration snippet.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Header with class declaration</Title>
<Description>Code snippet for class declaration</Description>
<Shortcut>header</Shortcut>
</Header>
<Snippet>
<Declarations>
@vladimirgamalyan
vladimirgamalyan / JsonCommentsInputFilter.hpp
Created August 6, 2015 08:27
Remove single and multi line comments from json
#pragma once
#include <boost/iostreams/filtering_stream.hpp>
class JsonCommentsInputFilter : public boost::iostreams::input_filter
{
public:
JsonCommentsInputFilter() : currentChar(UNDEFINED), prevChar0(UNDEFINED),
prevChar1(UNDEFINED), prevChar2(UNDEFINED), prevChar3(UNDEFINED),
insideString(false), insideComment(NO_COMMENT)
{
@vladimirgamalyan
vladimirgamalyan / HexString.h
Last active September 28, 2021 04:29
Make std::string hex representation of array
#pragma once
#include <sstream>
#include <iomanip>
#include <vector>
class HexString
{
public:
HexString& hexArray()
@vladimirgamalyan
vladimirgamalyan / PartSlicer.h
Last active November 17, 2015 18:27
Split <totalSize> by <partSize>
#pragma once
class PartSlicer
{
public:
PartSlicer(size_t totalSize, size_t partSize) : totalSize(totalSize), partSize(partSize), offset(0) {}
void nextPart()
{
if (offset < totalSize)
@vladimirgamalyan
vladimirgamalyan / fix.py
Created February 16, 2016 09:59
normalize path letter case
"""
normalize_path_case convert path
c:\foo\bar.txt
to
C:\Foo\Bar.txt
(as the file presents at file system, include case resgister)
"""
def correct_case(where, name):
if where.endswith(':'):