Skip to content

Instantly share code, notes, and snippets.

View igorcoding's full-sized avatar
🍹
Having fun

Igor Latkin igorcoding

🍹
Having fun
View GitHub Profile
@igorcoding
igorcoding / apache_log_parse.py
Created January 29, 2014 16:03
Apache access log file regex parsing
import re
from pprint import pprint
def parse_request(request_str):
pattern = re.compile(r"""(?P<method>.*)\s # method, space
(?P<url>.*)\s # url, space
(?P<protocol>.*) # protocol
""", re.VERBOSE)
match = pattern.match(request_str)
import datetime
import json
import requests
from random_words import *
import random
import MySQLdb
import MySQLdb.cursors
users = []
forums = []
<!doctype html>
<html>
<head>
<title>Socket.IO chat</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font: 13px Helvetica, Arial; }
form { background: #000; padding: 3px; position: fixed; bottom: 0; width: 100%; }
form input { border: 0; padding: 10px; width: 90%; margin-right: .5%; }
form button { width: 9%; background: rgb(130, 224, 255); border: none; padding: 10px; }
@igorcoding
igorcoding / batch_rename.sh
Created January 11, 2015 20:28
Batch rename
#! /bin/bash
SRC=$1
DEST=$2
i=1
for ph in ${SRC}/*; do
filename=$(basename "$ph")
ext="${filename##*.}"
new_filename="${i}.${ext}"
#echo $new_filename
@igorcoding
igorcoding / series_analyser.py
Created April 18, 2015 19:00
Some time series analysing
from pprint import pprint
import math
from scipy.optimize import curve_fit
import numpy as np
import matplotlib.pyplot as plt
import pylab
import scipy.stats as stats
import sklearn.linear_model
use 5.010;
use strict;
use warnings;
use AnyEvent;
use AnyEvent::Handle;
use AnyEvent::Socket;
use AnyEvent::Log;
use Data::Dumper;
@igorcoding
igorcoding / screenshot.sh
Created June 7, 2015 17:50
Make screenshot and upload it to Dropbox
#! /bin/sh
TIMESTAMP=`date +%Y-%m-%d-%H-%M-%S`
IMAGEPATH=$HOME/Dropbox/Public/Screenshots/Screenshot_$TIMESTAMP.png
gnome-screenshot $1 -f $IMAGEPATH
dropbox puburl $IMAGEPATH | xclip -selection clipboard
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="d:\home\site\wwwroot\go\bin\go.exe"
arguments="run d:\home\site\repository\app.go"
startupTimeLimit="60">
<environmentVariables>
import tensorflow as tf
import tensorflow.examples.tutorials.mnist.input_data
import numpy as np
mnist = tensorflow.examples.tutorials.mnist.input_data.read_data_sets("MNIST_data/", one_hot=True)
image_size = 28
n_labels = 10
def create_w_b(n_prev_layer, n_next_layer):
import tensorflow as tf
import tensorflow.examples.tutorials.mnist.input_data
import numpy as np
mnist = tensorflow.examples.tutorials.mnist.input_data.read_data_sets("MNIST_data/", one_hot=True)
image_size = 28
n_labels = 10
def create_w_b(n_prev_layer, n_next_layer):