Skip to content

Instantly share code, notes, and snippets.

@itsPG
itsPG / git_config.sh
Last active September 12, 2022 01:36
git config
# User
git config --global user.name YOUR_NAME
git config --global user.email YOUR_EMAIL@gmail.com
git config --global core.editor vim
# Common
git config --global alias.st status
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.br branch
#!/usr/bin/env python2
import sys
import os
import hashlib
def chunk_reader(fobj, chunk_size=1024):
"""Generator that reads a file in chunks of bytes"""
while True:
chunk = fobj.read(chunk_size)
@itsPG
itsPG / gist:8858692
Last active November 10, 2018 16:02

畢業出清 全部半價以下出清 大約是2.5折~4.x折的價格 剛考完的N2成績單:http://i.imgur.com/ELD8Nss.png

1.考上日檢N3的文法筆記本 原290 考上日檢N3的單字筆記本 原290 全新未用 原價580 售 250

2.考上日檢N2的文法筆記本 原290

@itsPG
itsPG / gist:42de79e2f236e95a39db
Created January 19, 2016 07:34
ExtUnderScore.js
Ext.define('Underscore', {
singleton: true,
constructor: function() {
// Underscore.js 1.8.3
// http://underscorejs.org
// (c) 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function() {
@itsPG
itsPG / arena.cpp
Last active January 4, 2016 09:28
/*
勝率70%的話,打競技場十勝以上的機率是25%左右,12勝機率是16%
拿實況主hcm的戰績來驗證一下想法
改版後參加競技場次數:73, win:497, lose:209, 勝率70.5%
十勝以上次數:19次,12勝次數:8次
按照機率算:
參加次數73次的話,約有18.25次可以拿到十勝以上,11.68次可以拿到12勝
而實際次數分別是19次以及8次
不可否認勝率打到後面會越來越低因此12勝的機率會比預測的少
@itsPG
itsPG / urlDecode.js
Created January 4, 2016 06:30
urlDecode.js
function urlDecode(query) {
var queryString = query || window.location.search.slice(1),
decodeFn = window.decodeURIComponent,
options = decodeFn(queryString).split('&'),
pair, i, ret = {};
for (i = 0; i < options.length; ++i) {
pair = options[i].split('=');
ret[pair[0]] = pair[1];
}
@itsPG
itsPG / adjust.js
Created January 3, 2014 19:00
PG's auto img adjuster
// ==UserScript==
// @name PG's auto img adjuster
// @namespace http://itsPG.org
// @version 0.1
// @description
// @match http://*/*
// @copyright 2014, PG
// ==/UserScript==
PG_jQuery_loader = {};
PG_jQuery_loader.getScript = function(filename)
@itsPG
itsPG / os3.cpp
Created October 7, 2013 06:41
os hw3 sol ? I'm not sure it is the solution or not.
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
@itsPG
itsPG / flower.cpp
Created August 28, 2013 08:52
by PG @ SENSE Lab
#include <iostream>
#include <algorithm>
using namespace std;
int flower[] = {1,2,3,4,5,6,7,8};
bool check_pick()
{
for (int i = 3; i < 8; i++)
if (flower[i] > flower[0] && flower[i] > flower[1] && flower[i] > flower[2])
return flower[i] == 8;