Skip to content

Instantly share code, notes, and snippets.

@McSinyx
McSinyx / bai3.py
Created April 12, 2016 10:41
Bài 3 Tin học trẻ Ba Đình 2015-2016 viết trên Python 3.5
#!/usr/bin/env python3
d = dict()
with open('bai3.inp') as f:
for i in f.readlines():
for j in '.,;!?':
i = i.replace(j, ' ')
for j in i.split():
d[j] = d.get(j, 0) + 1
l = [(value, key) for (key, value) in d.items()]
l.sort(reverse=True)
@McSinyx
McSinyx / buy.pas
Last active May 3, 2016 14:11
Bài thi giải ba bảng C Tin học trẻ Thành phố Hà Nội năm học 2015 - 2016
(* File name are supposed to be in upper case, but lower case names look more *mordern*.
* `buy.pas' run first, read input from `buy.inp', write to `buy.out'
* `set.pas' run next, read from `set.inp', write to `set.out'
* `play.pas' run last, read from `map.inp', write to `decision.out'
* (LMAO dunno how to sort files in Gist)
*)
var
f : text;
a : array[1..10] of qword;
@McSinyx
McSinyx / Card.py
Last active July 2, 2016 07:32
Probabilities of Poker hands
#!/usr/bin/env python3
"""
This module contains code from
Think Python by Allen B. Downey
http://thinkpython.com/code/Card.py
Copyright 2016 Raphael McSinyx
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
@McSinyx
McSinyx / findtext.c
Last active July 24, 2016 03:07
FINDTEXT - NTUcoder problem 5548
/*
* Trò chơi tìm chữ 3 <http://laptrinh.ntu.edu.vn/Problem/Details/5548>
*
* Copyright (C) 2016 Raphael McSinyx
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@McSinyx
McSinyx / circlenum.c
Created July 29, 2016 02:13
CIRCENUM - Số vòng
/*
* CIRCENUM - Số vòng <http://laptrinh.ntu.edu.vn/Problem/Details/5548>
*
* Copyright (C) 2016 Raphael McSinyx
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@McSinyx
McSinyx / performance_test.py
Last active August 31, 2016 10:09
XOR query
#!/usr/bin/env python3
# Test the performance of XOR query
# Copyright (C) 2016 Raphael McSinyx
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@McSinyx
McSinyx / vle.py
Last active February 24, 2017 04:41
VLE Broadcast Downloader
#!/usr/bin/env python3
# VOA Learning English Broadcast Downloader
# Copyright (C) 2016,2017 Raphael McSinyx
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@McSinyx
McSinyx / min.css
Last active September 4, 2020 02:32
HTML template with 80-char width and tango color palette
/*
* A 80-char wide stylesheet with Tango color palette
* Copyright 2016 Raphael McSinyx
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@McSinyx
McSinyx / vi-char.md
Last active November 22, 2018 14:40
Một vài đặc điểm loại hình tiếng Việt

Một vài đặc điểm loại hình tiếng Việt

Phương thức hư từ

Các ý nghĩa ngữ pháp, mà đặc biệt là các mối quan hệ ngữ pháp giữa các từ, có thể được thể hiện bằng các hư từ. Đó chính là phương thức hư từ:

Tôi đang ăn cơm.

Tuy nhiên trong các ngôn ngữ biến hình (như tiếng Anh), hư từ có thể được sử

@McSinyx
McSinyx / ui.py
Last active March 20, 2017 04:19
comp - console/curses online media player
#!/usr/bin/env python3
import curses
import json
import python_mpv_zws as mpv
with open('yt.json') as f:
DATA = json.load(f)
for i in DATA: