Skip to content

Instantly share code, notes, and snippets.

View quasarj's full-sized avatar
💭
SEND HALP

Quasar Jarosz quasarj

💭
SEND HALP
View GitHub Profile
! 66 = Capslock Key
keycode 66 = Super_L NoSymbol Super_L
! 133 = Left Windows Key
keycode 133 = Hyper_L NoSymbol Hyper_L
! 108 = Right Alt Key (remapped to tilde)
keycode 108 = grave asciitilde grave asciitilde
! 105 = Right Control Key
clear lock
clear mod5
clear mod4
@quasarj
quasarj / primepal.py
Last active August 29, 2015 14:02
Print the largest prime palindrome under 1000.
#!/usr/bin/env python2
def reverse_str(string):
return string[::-1] # because there is no builtin :(
def is_palindrome(number):
if number < 10:
return True
num_str = str(number)
@quasarj
quasarj / shoot
Created April 25, 2014 14:37
shoot
#!/bin/bash
#
# By Sirupsen @ http://sirupsen.dk
#
# Description: Very simple script to make you
# select a region of your screen, which will be captured, and
# then uploaded. The URL will then be injected into your clipboard.
#
# Dependencies:
#
with people as (
select
-- name and age are the primary keys
'Quasar' as name,
30 as age,
'brown' as hair_color
from dual
union select
'Josh' as name,
from __future__ import print_function
import os
import time
from multiprocessing import Pool
from multiprocessing.dummy import Pool as ThreadPool
def images():
"""Use a generator to read/process the list of images,
so map() can be used below"""
@quasarj
quasarj / phantom-progress.sh
Created December 31, 2011 04:08
phantom-progress.sh
#!/bin/bash
fd=/proc/$1/fd/$2
fdinfo=/proc/$1/fdinfo/$2
name=$(readlink $fd)
size=$(wc -c $fd | awk '{print $1}')
while [ -e $fd ]; do
progress=$(cat $fdinfo | grep ^pos | awk '{print $2}')
echo $((100*$progress / $size))
sleep 1
done | dialog --gauge "Progress reading $name" 7 100
@quasarj
quasarj / scrabble.py
Created December 7, 2011 20:29
quasarj's answer for r/python's Weekly Quiz #1
import sys
import itertools
if len(sys.argv) < 3:
raise IndexError("Not enough arguments!")
with open(sys.argv[1]) as words_file:
words = [a.strip() for a in words_file]
letters = sys.argv[2:]