Skip to content

Instantly share code, notes, and snippets.

View cocuh's full-sized avatar
🛌
Comfy bed sleeping

cocuh cocuh

🛌
Comfy bed sleeping
View GitHub Profile
@cocuh
cocuh / gpa.py
Last active December 19, 2015 21:19
筑波大学の成績管理システムtwinsから成績のcsvをダウンロードして引数に渡すとGPAが算出されるPythonワンライナーだよ☆
globals().__setitem__('c',lambda n,f:globals().__setitem__(n,f));c('t',float);c('s',__import__('sys'))or c('f',lambda l,A=0,B=0:f(l[1:],A+l[0][0],B+l[0][1])if l else(A,B));c('p',lambda x:s.stdout.write(x+'\n'));p((lambda x,y:"your GPA is {f}".format(f=y/x))(*f([(lambda x,y:(0,0)if y in['P','F']else(t(x),t(x)*dict([(x,n)for n,x in enumerate(['D','C','B','A','A+'])])[y]))(*[y[1:-1] for n,y in enumerate(x.split(","))if n in[5,6]])for x in open(s.argv[1]).read().splitlines()[1:]])))if len(s.argv[1:])else p("USAGE: gpa.py csvfile")
@cocuh
cocuh / めも
Last active December 20, 2015 08:49
めも
\\x3c/script\\x3e\\x3cscript\\x3ealert("XSS");
\\074script\\076alert("XSS");\\074\\057script\\076
:
@cocuh
cocuh / yukichi.py
Last active December 22, 2015 01:59
ゆきちせんせいじぇねれーたほしい
class Yukichi:
num = 0
def __init__(self):
self.hakkou_bangou=self._gen_id()
@classmethod
def _gen_id(cls):
cls.num += 1
return cls.num
def __str__(self):
return "yukichi_sensei"
@cocuh
cocuh / recipedb.py
Created November 4, 2013 20:40
minecraft recipe sql test
from sqlalchemy import (
create_engine,
Index,
Column,
ForeignKey,
Integer,
String,
Table,
)
@cocuh
cocuh / sqlalchemy_template.py
Last active December 27, 2015 23:49
template for trying simple code in sqlalchemy.
from sqlalchemy import (
Column,
Integer,
String,
Unicode,
UnicodeText,
ForeignKey,
event,
create_engine,
)
@cocuh
cocuh / recipesql.py
Last active December 28, 2015 00:19
from sqlalchemy import (
Column,
Integer,
String,
Unicode,
UnicodeText,
ForeignKey,
event,
create_engine,
Boolean,
#!/usr/bin/env python
import os
import sys
import subprocess
import shlex
import argparse
import random
CONFIG_PATH = os.path.expanduser('~/.config/wallpaperchanger.conf')
window.onload = function(){
console.log('external javascript:'+document.domain);
document.getElementById("elem_ex").onclick=function(){
console.log('external javascript onclick:'+document.domain)
};
};
console.log("console log: "+document.domain)
<html>
<head>
<meta charset="UTF-8"/>
<title>background-image</title>
<script>console.log(document.title)</script>
</head>
<body>
background-image
<div style="background-image:url(xss.svg);height:300px;width:300px"></div>
</body>