👨‍💻 Блог Анатолия Гуляева

Separate the Octopress blog into two different repos

My blog is running on octopress + github pages, so at first I had in my blog repo two branches:

  • master
  • source

The source branch is a place where I make changes, edit posts, add images etc. The master branch is generated and deployed by rake. This branch is acting like a hosting for gh-pages.

I wanted to split the repo so I used these following commands:

$ git remote add blog https://github.com/johnnykernel/blog.git

$ git push -u blog source

$ git push origin --delete source

Thus the master branch stays in johnnykernel.github.io repo. But the source branch moved to newly created repo called blog


Image processing using NumPy and SciPy

script

little script written in python that sort an image array by column:

image_processing.py
import numpy as np
import scipy.misc

image = "/Users/username/image.jpg"

image_array = scipy.misc.imread(image)
a = np.sort(image_array, axis=0)

scipy.misc.imsave('outimage.jpg', a)

examples

Two images processed with my Python script. Left image is original. You can see japanese street on it. The right is the same image, but pixels are sorted by column.
Two images processed with my Python script. Left image is original. You can see anime girl on it. The right is the same image, but pixels are sorted by column.
Two images processed with my Pyhton script. Left image is original. You can see trees and lake in sunset on it. The right is the same image, but pixels are sorted by column.

Neon Genesis Evangelion: all backgrounds with wires

Description

  • This is a collection of all evangelion backgrounds that contain wires from every episode(soon).
  • Resolution: 960x720 px
  • BDRip

Why?

I like wires.

ep01

Evangelion Screenshot - Episode 1
Evangelion Screenshot - Episode 1
Evangelion Screenshot - Episode 1
Evangelion Screenshot - Episode 1
Evangelion Screenshot - Episode 1
Evangelion Screenshot - Episode 1
Evangelion Screenshot - Episode 1
Evangelion Screenshot - Episode 1

ep03

Evangelion Screenshot - Episode 3
Evangelion Screenshot - Episode 3
Evangelion Screenshot - Episode 3
Evangelion Screenshot - Episode 3
Evangelion Screenshot - Episode 3
Evangelion Screenshot - Episode 3
Evangelion Screenshot - Episode 3
Evangelion Screenshot - Episode 3

ep04

Evangelion Screenshot - Episode 4
Evangelion Screenshot - Episode 4
Evangelion Screenshot - Episode 4
Evangelion Screenshot - Episode 4
Evangelion Screenshot - Episode 4
Evangelion Screenshot - Episode 4

Twilight (1994) by Tengai Amano - Unofficial Soundtrack

film itself

When death comes to a young boy in the prime of his life, he refuses to accept it and decides to escape this tragic fate by running away from place to place, trying to stay alive a little longer, holding himself to the memories of his family among other things. But running away from death can be a helpful solution? This marked Tengai Amano’s directorial debut short film, earning him several prizes.

  • Written by Rodrigo Amaro

unofficial soundtrack

Download


Notes on simple Twitter image bot

source code

Don’t forget:

  1. Install tweepy
  2. Register your app

twitterImageBot.py:

import tweepy
import glob
import random
import os
import shutil

api_key = "api_key"
api_secret = "api_secret"
oauth_token = "access_token"
oauth_token_secret = "access_token_secret"
auth = tweepy.OAuthHandler(api_key, api_secret)
auth.set_access_token(oauth_token, oauth_token_secret)
api = tweepy.API(auth)

abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)

def randomimagetwitt(folder):
    images = glob.glob(folder + "*")
    image_open = images[random.randint(0,len(images))-1]
    api.update_with_media(image_open)
    shutil.copy(image_open, "copied_images/")
    os.remove(image_open)

randomimagetwitt("images_to_post/")

if you want your bot to simply post images every N minutes/hours/days, this bot would be perfect for you. it just takes a random image from the folder images_to_post/, post it using tweepy library, copy the image to the folder copied_images/ and finally removes it. so there will never be repeated images.

crontab scheduling

this is how my crontab schedule looks like (the bot posts a picture every 30 minutes):

0,30 * * * * python /Users/johnny/some_bots/ImageBotTwitter/image_bot.py