Skip to content

Instantly share code, notes, and snippets.

View tsukumijima's full-sized avatar
📺
DTV

tsukumi tsukumijima

📺
DTV
View GitHub Profile
@chikatoike
chikatoike / windows-ctrl-c.py
Created April 20, 2013 02:53
WindowsでGenerateConsoleCtrlEventを使ってctrl-cをエミュレートしてプロセスグループ全体を終了したい。 なぜかforループの2番目は子プロセスと孫プロセスが終了できない。
import sys
import time
import ctypes
import subprocess
CTRL_C_EVENT = 0
CTRL_BREAK_EVENT = 1
if len(sys.argv) == 1:
for i in range(2):
@zabbarob
zabbarob / 7-zip-default-extract.reg
Last active January 13, 2025 15:09
WARNING: This gist is from 2013 and will likely no longer work with current versions of 7-Zip and Windows. - Make 7-Zip extract to folder when double-clicking archives.(based on http://superuser.com/a/447791)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\7-Zip.001\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.001\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.001\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.7z\shell]
@uupaa
uupaa / markdown.syntax.md
Last active January 16, 2022 10:17
Markdown Syntax, markdown, md

GitHub, Hatena, Google+ で使える Markdown

GitHub Hatena Google+
<style>
<link> ? ?
<div> YES YES
<h1> YES YES
<br> YES YES
@think49
think49 / escaperegexpchar.js
Last active April 2, 2022 10:11
escaperegexpchar.js: 正規表現文字列をエスケープします(ES5準拠)。エスケープ文字列は new RegExp() に渡すことができます。
/**
* escaperegexpchar.js
* Escape the regular expression string (ES5 compliant).
* Escape string can be passed to the () new RegExp().
*
* @version 1.0.2
* @author think49
* @url https://gist.github.com/think49/7691225
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
* @see <a href="http://es5.github.io/#x15.10.1">15.10.1 Patterns - Annotated ES5.1</a>
@kazua
kazua / convDate2.php
Created December 26, 2013 15:54
PHPで西暦⇔和暦変換
<?php
//write kazua
function convGtJDate($src) {
list($year, $month, $day) = explode('/', $src);
if (!@checkdate($month, $day, $year) || $year < 1869 || strlen($year) !== 4
|| strlen($month) !== 2 || strlen($day) !== 2) return false;
$date = str_replace('/', '', $src);
if ($date >= 19890108) {
$gengo = '平成';
@lilydjwg
lilydjwg / ttc2ttf
Last active May 2, 2025 05:29
Convert .ttc to several .ttf files into the current directory
#!/usr/bin/env python3
import sys
import fontforge
def main(file):
for font in fontforge.fontsInFile(file):
f = fontforge.open(u'%s(%s)' % (file, font))
f.generate('%s.ttf' % font)
@drmalex07
drmalex07 / helloworld-win32-service.py
Created April 12, 2014 20:08
An example Windows service implemented with pywin32 wrappers. #python #windows-service #pywin32
import win32serviceutil
import win32service
import win32event
import servicemanager
import socket
import time
import logging
logging.basicConfig(
filename = 'c:\\Temp\\hello-service.log',
// 現在実行中のスクリプトタグを取得
var currentScript = document.currentScript || (function() {
var nodeList = document.getElementsByTagName('script')
return nodeList.item(nodeList.length - 1)
}())
var text = currentScript.text // text で内部テキストが取得できる。
//=> "\n ここのテキストを取得したい\n "
@orumin
orumin / mpegts2h264.sh
Last active February 10, 2023 09:25
MPEG2-TS to H.264 within gstreamer on RaspberryPi
#!/usr/bin/bash
#
# Usage: mpegts2h264.sh <src.ts> <dst.mp4>
#
program_no=$(ffmpeg -i $1 2>&1 | grep Program | head -n 1 | awk '{ print $2 }')
video_sid=$(ffmpeg -i $1 2>&1 | grep Stream | grep Video | sed -e "s/^.*Stream #0:0\[0x\([0-9a-f][0-9a-f][0-9a-f]\)\].*$/\1/g")
audio_sid=$(ffmpeg -i $1 2>&1 | grep Stream | grep Audio | sed -e "s/^.*Stream #0:1\[0x\([0-9a-f][0-9a-f][0-9a-f]\)\].*$/\1/g")
gst-launch-1.0 filesrc location=./$1 ! progressreport ! \
@salipro4ever
salipro4ever / rc4.js
Last active May 31, 2023 18:48 — forked from farhadi/rc4.js
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';