This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here is a list of scopes to use in Sublime Text 2 snippets - | |
ActionScript: source.actionscript.2 | |
AppleScript: source.applescript | |
ASP: source.asp | |
Batch FIle: source.dosbatch | |
C#: source.cs | |
C++: source.c++ | |
Clojure: source.clojure | |
CoffeeScript: source.coffee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int base = 1000000000; const int base_digits = 9; | |
struct bigint{ | |
vector<int> a; int sign; | |
bigint(): | |
sign(1){ | |
} | |
bigint(long long v){ | |
*this = v; | |
} | |
bigint(const string &s){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define _ ios::sync_with_stdio(0); cin.tie(0); | |
using namespace std; | |
const int mod = 1000000007; | |
struct tnode{ | |
int64_t sum = 0, mul = 1, add = 0, updated = 0; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
from itertools import count | |
import requests | |
url = 'http://alpha.wallhaven.cc/search?categories=101&sorting=favorites&order=desc&page=' | |
jpg = 'http://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-%s.jpg' | |
png = 'http://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-%s.png' | |
status = '\r[page {:0>3}] [image {:0>2}|24] [{:.<24}]'.format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url(https://fonts.googleapis.com/css?family=Open+Sans); | |
* { | |
margin:0; | |
padding:0; | |
-webkit-box-sizing:border-box; | |
-moz-box-sizing:border-box; | |
box-sizing:border-box; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
r = requests.get('https://graph.facebook.com/838978412886942/invitable_friends?fields=picture{url}&limit=1000&access_token=_your_token_') | |
data = json.loads(r.text) | |
dpids = [i['picture']['data']['url'].split('_', 2)[1] for i in data['data']] | |
ind = 0 | |
for i, dpid in enumerate(dpids, 1): | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
import sys | |
import zipfile | |
try: | |
os.mkdir('input') | |
os.mkdir('output') | |
except OSError: | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
prime = numpy.ones(limit/2, dtype=numpy.bool) | |
for i in xrange(3, int(limit**.5) + 1, 2): | |
if prime[i/2]: | |
prime[i*i/2: : i] = False | |
primes = 2*prime.nonzero()[0] + 1 | |
primes[0] = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
namespace __io__ { | |
static struct IN { | |
char buff[1 << 10]; | |
char c; | |
inline operator bool() { | |
return c > 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from contextlib import contextmanager | |
from sys import stderr | |
from timeit import default_timer as now | |
import atexit | |
@contextmanager | |
def timeit(s=''): | |
start = now() | |
yield | |
print >>stderr, '-- %06.3fs' % (now() - start), '|', s |
OlderNewer