Skip to content

Instantly share code, notes, and snippets.

View staybuzz's full-sized avatar

Yuuki Mori staybuzz

  • The University of Electro-Communications
View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
int main(){
int width, height, level;
int x,y; // X軸、Y軸
int i;
char s[10]; // ヘッダのファイル形式を格納
char nl[2]; // 改行記号を格納
unsigned char *data; // 画像データ
@staybuzz
staybuzz / prepare_concat_ffmpeg.py
Created February 12, 2016 17:49
分割されたtsファイルをffmpegを使って結合するための準備スクリプト。get_maaya.pyを実行したディレクトリで使うと良い。
import commands
for i in range(216):
arg = []
num = commands.getoutput("ls "+"{0:03d}".format(i+1)+"-*|wc -l")
if (num[0]=='l'): continue
for j in range(int(num)):
arg.append("{0:03d}".format(i+1)+"-"+str((j+1))+".ts")
args = "concat:"+"|".join(arg)
print "ffmpeg -i \"" +args + "\" -c copy -y \"" + "{0:03d}".format(i+1) + ".ts\""
@staybuzz
staybuzz / get_maaya.py
Created February 12, 2016 16:23
まあやおねえさんをお迎えするスクリプト
#coding: utf-8
#!/usr/bin/env python2
import re
import requests
import lxml.html
import urllib
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
#coding: utf-8
"""
requirement:
ffmpeg
usage example:
$ ls *.mp3 | python mp32wav.py
input: test.mp3
@staybuzz
staybuzz / oregairu_hook.py
Last active December 13, 2015 17:05
俺ガイル公式ページの最新ニュースを拾ってくるやつ
#!/usr/bin/env python2
# coding: utf-8
import re
import requests
import lxml.html
from selenium import webdriver
class oregairu_hook(object):
def __init__(self):
@staybuzz
staybuzz / sample.c
Created November 12, 2015 05:03
シグナルハンドラとexecveを使ってみる
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
static int *p = NULL;
static void execute_command(){
char *argv[] = {"/bin/sh", "-c", "'date'", NULL};
execve(argv[0], argv, NULL);
#!/bin/sh
#ref: http://orebibou.com/2014/01/esxi%E4%B8%8A%E3%81%AE%E4%BB%AE%E6%83%B3%E3%83%9E%E3%82%B7%E3%83%B3nic%E3%81%AEmac%E3%82%A2%E3%83%89%E3%83%AC%E3%82%B9%E4%B8%80%E6%8B%AC%E5%8F%96%E5%BE%97%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88/
#Get VM List
VimCmdList=`vim-cmd vmsvc/getallvms | grep "vmx-" | grep ".vmx" | awk '{print $2,$3,$4}'`
IFS=$'\n'
cat /dev/null > tmp.list
cat /dev/null > 1-6.list
for i in $VimCmdList; do
#Get VM Name
VMName=`echo "$i" | awk '{print $1}'`
##################################
# Create Virtual Distributed PortGroup
# VLAN 20 - 160
20..160 | foreach {
Get-VDSwitch -Name "test" | New-VDPortgroup -Name ("VLAN{0:0}" -F $_) -NumPorts 15 -VLanId $_
}
# Create VM from Template
1...15 | foreach {
New-VM -Name ("T{0:0}mori_common" -F $_) -Datastore 'datastore1' -Template common-Template -ResourcePool Resources -DiskStorageFormat thin
@staybuzz
staybuzz / mkpg.sh
Created August 17, 2015 00:09
make portgroup on vcenter from csv
#!/bin/sh
#csvfile=vlan-list.csv
# s -> source csv file
# n -> name of vswitch
# TODO: option is required
# $ ./mkpg.sh -s vlan-list.csv -n vswitch1
while getopts s:n: OPT
/\_/\
|     |
|・  ・ |
| |
〄  ⊂⊃  ノ
 ` _ ’