Skip to content

Instantly share code, notes, and snippets.

View st98's full-sized avatar

st98 st98

View GitHub Profile
{p} # => {p: p}
{p} = obj # => var p; p = obj.p;
{p: p} = obj # => var p; p = obj.p;
from ctypes import windll
windll.user32.MessageBoxW(0, u'めっせーじ', u'たいとる', 0x40)
@st98
st98 / mml-modoki.py
Last active August 29, 2015 14:14
たのしい winsound モジュール。play('ccggaagrffeeddcr')。
import time
import winsound
_table = { 'c': 523, 'd': 587, 'e': 659, 'f': 698, 'g': 784, 'a': 880, 'b': 988 }
_dur = 60000 // 80
def play(s):
s = s.lower()
for c in s:
if c not in 'cdefgabr':
@st98
st98 / w.py
Last active August 29, 2015 14:14
たのしい winsound モジュール。Windows 限定。
import time
import winsound
dur = 60000 // 80
def main():
winsound.Beep(523, dur)
winsound.Beep(523, dur)
winsound.Beep(784, dur)
winsound.Beep(784, dur)
@st98
st98 / a.bat
Last active August 29, 2015 14:13
%PATHEXT%
> echo %PATHEXT%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY
> type a.bat
echo a.bat
> type a.cmd
echo a.cmd
> a
a.bat
#define ZERO 0
int main(void) {
return ZERO;
}
#include <stdio.h>
void f(void) {
puts("f");
return;
}
void g(void) __attribute__ ((weak, alias("f")));
int main(void) {
g();
return 0;
@st98
st98 / r.c
Last active August 29, 2015 14:13
./r 1 2:10
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
char *s;
int i, n;
for (i = 1; i < argc; i++) {
n = (strchr(argv[i], ':')) ? strtol(s + 1, (char**) NULL, 10) : 32;
srand(strtol(argv[i], (char**) NULL, 10));
for (;n--;) {
@st98
st98 / regexp.js
Last active August 29, 2015 14:13
/[\s\S]+/
/.+/.test('\n'); // => false
/[\s\S]+/.test('\n'); // => true
'/*hoge\n*/fuga*/'.replace(/\/\*[\s\S]*?\*\//g, ''); // => 'fuga*/'
document.body.innerHTML = document.body.innerHTML.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\n{2,}/g, '\n\n');
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="style.css">
<title>index.html</title>
</head>
<body>
<h1>index.html</h1>