Skip to content

Instantly share code, notes, and snippets.

Avatar

mipsparc mipsparc

View GitHub Profile
@mipsparc
mipsparc / pnginfo.py
Created Jan 5, 2015
PNGメタデータを簡単に表示するもの
View pnginfo.py
#coding:utf-8
#Print some infomation of a PNG file
import struct
import datetime
import binascii
def crcChecker(data, crc):
computedCRC = binascii.crc32(data)
@mipsparc
mipsparc / pngencoder.py
Created Jan 5, 2015
簡易PNGエンコーダ
View pngencoder.py
#coding:utf-8
#Make a PNG file
IMAGE = (
'0000000000000000',
'0000000000000000',
'0111111111111110',
'0000000000000000',
'0000111111110000',
'0000010000010000',
@mipsparc
mipsparc / pngenccolour.py
Last active Aug 29, 2015
簡易カラーPNGエンコーダ
View pngenccolour.py
#coding:utf-8
#Make a PNG file
IMAGE = (
'cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54',
'cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54',
'cdbc54ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcdbc54',
'cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54cdbc54',
'cdbc54cdbc54cdbc54cdbc54ffffffffffffffffffffffffffffffffffffffffffffffffcdbc54cdbc54cdbc54cdbc54',
'cdbc54cdbc54cdbc54cdbc54cdbc54ffffffcdbc54cdbc54cdbc54cdbc54cdbc54ffffffcdbc54cdbc54cdbc54cdbc54',
@mipsparc
mipsparc / mosaic.py
Last active Feb 13, 2016
Make a mosaic art randomly with your favorite colour. (Only work on Python3)
View mosaic.py
#coding:utf-8
outname = 'out.png'
import struct
import binascii
import zlib
from math import ceil
import codecs
import random
@mipsparc
mipsparc / ix_uptime.py
Last active Apr 5, 2016
NEC IXシリーズのルータから自動でuptimeを取得するやつ。実行にはPython3が必要。IX2015以外かホスト名を変更している場合は、headerを変更すること。ex)$ ./ix_uptime.py 192.168.0.1 username password
View ix_uptime.py
#!/usr/bin/env python3
#ex) $ ix_uptime.py 192.168.0.1 username password
import getpass
from telnetlib import Telnet
from sys import argv
header = "IX2015# "
command = "show uptime\r"
#HOST = input("Enter your IX\'s IP addr: ")
#user = input("Enter your remote account: ").encode('ascii')
View sfn_checksum.py
filename = 'TEST TXT'
total = 0
for newchar in filename:
#rotate(一番右のビットは一番左に)
total = ((total & 1) << 7) + (total >> 1)
#add
total += ord(newchar)
#桁溢れ防止
total = total & 0xFF
@mipsparc
mipsparc / fat_ls.py
Last active Apr 12, 2016
show SFN like ls on FAT12/FAT16(prototype)
View fat_ls.py
import struct
FILENAME = 'testimg1'
data = open(FILENAME, 'rb').read()
dir_start = 1536 #0x600
entry_size = 32
while True:
name, attr = struct.unpack_from(b'> 11s c', data, dir_start)
if name==b'\x00'*11:
@mipsparc
mipsparc / nicovideo-dl
Created Apr 16, 2016
Fork of nicovideo-dl(https://osdn.jp/projects/nicovideo-dl/). Made for private using purpose
View nicovideo-dl
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2009 Keiichiro Nagano
# Copyright (c) 2009 Kimura Youichi
# Copyright (c) 2006-2008 Ricardo Garcia Gonzalez
# Copyright (c) 2008 Ying-Chun Liu (PaulLiu)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@mipsparc
mipsparc / multimp3.py
Last active Apr 16, 2016
simultaneously download nicovideo
View multimp3.py
#!/usr/bin/env python3
import multiprocessing
import subprocess
accounts =[
{'id':'1@example.com', 'pass':'password'},
{'id':'2@example.com', 'pass':'password'},
]
def download(account, download_urls):
@mipsparc
mipsparc / nicomp3.sh
Last active Apr 17, 2016
require nicovideo-dl
View nicomp3.sh
#! /bin/sh
if [ $# -eq 3 ];then
VIDEOURI=$1
USER=$2
PASS=$3
else
VIDEOURI=$(zenity --entry --title "URI入力 - nicomp3" --text "URIを入力してください")
USER='hoge@example.com'
PASS='password'
You can’t perform that action at this time.