Skip to content

Instantly share code, notes, and snippets.

View akiraaisha's full-sized avatar
🤔

Julian Lugod akiraaisha

🤔
  • Municipal Government of Cainta
  • Philippines
View GitHub Profile
@cdiener
cdiener / asciinator.py
Last active January 5, 2023 17:24
Convert image to ascii art
import sys; from PIL import Image; import numpy as np
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@'))
if len(sys.argv) != 4: print( 'Usage: ./asciinator.py image scale factor' ); sys.exit()
f, SC, GCF, WCF = sys.argv[1], float(sys.argv[2]), float(sys.argv[3]), 7/4
img = Image.open(f)
S = ( round(img.size[0]*SC*WCF), round(img.size[1]*SC) )
img = np.sum( np.asarray( img.resize(S) ), axis=2)
@juntalis
juntalis / msys-env.cmd
Created October 17, 2011 00:07
A (Windows) batch script to open the MSYS shell in the user's current window (cmd.exe or whatever wrapper you're using) at the user's current folder. It requires getcp.exe be in your msys bin folder. (getcp.exe is included with msysgit) It also generates
@rem Do not use "echo off" to not affect any child calls.
@SETLOCAL
@SETLOCAL ENABLEEXTENSIONS
:: Figure out where msys's root folder. If you want, you could just add the folder in the line
:: below.
@set MSYSROOT=
@if "x%MSYSROOT%"=="x" @if exist "%~dp0msys.bat" @set MSYSROOT=%~dp0
@if "x%MSYSROOT%"=="x" @if exist "%~dp0.msys-root" @set /P MSYSROOT=<%~dp0.msys-root
@if "x%MSYSROOT%"=="x" (