Skip to content

Instantly share code, notes, and snippets.

View Muratam's full-sized avatar
🌱
ぺこっぱマスター!

むらため Muratam

🌱
ぺこっぱマスター!
View GitHub Profile
@Muratam
Muratam / topietcolor.py
Created December 22, 2016 09:07
topietcolor.py
from PIL import Image
import sys
from colormath.color_objects import sRGBColor, LabColor
from colormath.color_conversions import convert_color
from colormath.color_diff import delta_e_cie2000
piet_colors = [
"000", "222",
"211", "221", "121", "122", "112", "212",
"200", "220", "020", "022", "002", "202",
@Muratam
Muratam / gochiusa_sokuho.py
Created December 14, 2016 10:31
gochiusa_sokuho.py
import twitter72
import requests
import re
import pickle
from urllib.parse import parse_qs
from pprint import pprint
from moviepy.editor import *
import random
import sys
import os
@Muratam
Muratam / analyze_mp4.py
Last active December 14, 2016 11:38
analyze_mp4.py
def analyze_mp4(filename, out_filename, comments, ok_time=3100):
"""
filename : 元となる動画ファイル名
out_filename : 生成した動画の保存ファイル名
comments : get_comments 関数で作成したコメント配列
ok_time : 3100 なら 31 * 100 で 開始31秒
"""
comments.sort(key=lambda x: x[1])
max_time = ok_time / 100.0
video = VideoFileClip(filename).subclip(0, max_time)
from twitter import Api
from requests_oauthlib import OAuth1Session
import requests
from pprint import pprint
import os
import json
def fav_word(c_key, c_secret, a_key, a_secret,query):
api = Api(c_key,c_secret,a_key,a_secret)
Shader "Custom/Mono"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_X ("Normalized X",Range(0,1)) = 0.2
_Y ("Normalized Y",Range(0,1)) = 0.2
_W ("Normalized Width",Range(0,1)) = 0.6
_H ("Normalized Height",Range(0,1)) = 0.6
}
using UnityEngine;
[RequireComponent(typeof(Camera))]
public class MonoImageEffect : MonoBehaviour {
private Material m_Material;
[SerializeField] Material material;
protected virtual void OnRenderImage(RenderTexture source, RenderTexture destination) {
Graphics.Blit(source, destination, material);
}
@Muratam
Muratam / private.xml
Created October 12, 2016 05:18
For Karabiner
<?xml version="1.0"?>
<root>
<vkopenurldef> <name>KeyCode::VK_OPEN_URL_MV.R</name>
<url type="shell"> <![CDATA[ osascript ~/.mv_window.js R]]> </url>
</vkopenurldef>
<vkopenurldef> <name>KeyCode::VK_OPEN_URL_MV.L</name>
<url type="shell"> <![CDATA[ osascript ~/.mv_window.js L]]> </url>
</vkopenurldef>
<vkopenurldef> <name>KeyCode::VK_OPEN_URL_MV.MAX</name>
<url type="shell"> <![CDATA[ osascript ~/.mv_window.js MAX]]> </url>
function show(x) { console.log(Automation.getDisplayString(x)) }
function showByApp(text) {
app = Application.currentApplication()
app.includeStandardAdditions = true
app.displayDialog(Automation.getDisplayString(text))
}
function getDockInfo() {
apps = Application("System Events").processes()
for (app of apps) {
if (app.name() != "Dock") continue
import re,requests,random
def getById(id):
body = requests.get("https://nijie.info/view.php?id="+ str(id)).content.decode("utf-8")
found = re.findall(r'"(https://\S+?nijie_picture\S+?\.(?:jpg|png|jpeg))"',body)
if found : return re.sub(r'/small_light\(\S+\)',"",found[0])
else : return ""
def randomGet():
r = random.randint(1005,187600)
@Muratam
Muratam / run_hs.bat
Created January 23, 2016 18:01
Run Haskell ,Ruby For VSCODE Runner
@echo off
if "%~dpnx1" equ "" goto :eof
cd "%~dp1"
setlocal
set tempfile=%date:~4%%time::=%
set tempfile=%tempfile:/=%
set tempfile=%tempfile:.=%
set tempfile=%tempfile: =%
ghc -o %tempfile%.exe --make "%~dpnx1"
%tempfile%.exe