This file contains hidden or 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
#!/bin/bash | |
scrot /tmp/screen.png | |
convert -blur 0x4 /tmp/screen.png /tmp/blur.png | |
rm /tmp/screen.png | |
i3lock -i /tmp/blur.png |
This file contains hidden or 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
syn keyword cType u_int8_t u_int16_t u_int32_t u_int64_t | |
" unicode operators | |
syn match cppOperator "<=" conceal cchar=≤ | |
syn match cppOperator ">=" conceal cchar=≥ | |
syn match cppOperator "!" conceal cchar=¬ | |
syn match cppOperator "!=" conceal cchar=≠ | |
syn match cppOperator "=" conceal cchar=← | |
syn match cppOperator "==" conceal cchar== | |
syn match cppOperator "\." conceal cchar=· |
This file contains hidden or 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
#!/usr/bin/env python | |
import os | |
import fcntl | |
import subprocess | |
import sys | |
# Equivalent of the _IO('U', 20) constant in the linux kernel. | |
USBDEVFS_RESET = ord('U') << (4*2) | 20 |
This file contains hidden or 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
#!/bin/ksh | |
USAGE="[s:screen][screen:=middle]" | |
STYLUS=$(xsetwacom --list | grep stylus | awk '{print $8}') | |
TOUCH=$(xsetwacom --list | grep touch | awk '{print $8}') | |
ERASER=$(xsetwacom --list | grep eraser | awk '{print $8}') | |
PAD=$(xsetwacom --list | grep pad | awk '{print $8}') | |
# 3 screens 5120x1440 default is the middle one |
This file contains hidden or 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 math import sqrt | |
from itertools import takewhile, dropwhile, count | |
def prime(): | |
primes = [] | |
for n in count(2): | |
composite = 0 | |
for p in primes: | |
if not n % p: | |
composite = 1 |
This file contains hidden or 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 math import sqrt | |
from itertools import takewhile, dropwhile, count | |
def comb(l): | |
if len(l) == 0: | |
yield [] | |
else: | |
for i in range(len(l)): | |
for cc in comb(l[:i] + l[i + 1:]): | |
yield [l[i]] + cc |
This file contains hidden or 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
print str(sum(i ** i for i in xrange(1, 1001)))[-10:] |
This file contains hidden or 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 itertools import count, islice | |
from operator import and_ | |
def factorise(n): | |
result = [] | |
check = 2 | |
while (check * check <= n): | |
if n % check == 0: | |
result.append(check) | |
n /= check |
This file contains hidden or 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 itertools import takewhile, count, imap | |
from math import sqrt | |
from operator import and_ | |
def twicesq(n): | |
return takewhile(lambda x: x < n, | |
(x * x * 2 for x in count(1))) | |
def isprime(n): | |
for x in range(2, int(sqrt(n)) + 1): |
This file contains hidden or 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 math import sqrt | |
from itertools import islice | |
from itertools import count | |
def pentagonal(n): | |
return not ((sqrt(24 * n + 1) + 1) / 6) % 1 | |
def hexagonal(n): | |
return not ((sqrt(8 * n + 1) + 1) / 4) % 1 |
NewerOlder