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 math import log | |
def toList(num): | |
return toList(num // 3) + [["L"], ["-"], ["R"]][num % 3] if num else [] | |
def solution(n): | |
return toList(n + sum(3**x for x in range(1 + int(log(n*2, 3))))) |
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
#!/bin/bash | |
a=1 | |
compile_video() | |
{ | |
trap exit SIGINT | |
# modify these as needed | |
FPS=15 |
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 threading import Thread, Lock, Condition, get_ident, current_thread | |
from collections import deque, namedtuple | |
import time | |
cond = Condition() | |
lock = Lock() | |
ThreadSub = namedtuple("ThreadSub", ["queue", "callbacks"]) | |
subscriptions = {"chat":{}, "file":{}} |
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
A trick to autheticate on connection to an IRC server | |
/connect irc.freenode.net 6667 :<username> <password> | |
In xchat, this means you put :<username> <password> into the server password 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
<html> | |
<head> | |
<title>Dithering Test</title> | |
</head> | |
<body> | |
<canvas></canvas> | |
<script> | |
var canvas = document.getElementsByTagName("canvas")[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
(function(){ | |
/* Set up */ | |
var input = jQuery("#inputfield"); | |
var space_key = jQuery("#config_input_key").attr("value"); | |
var chars_typed_so_far = 0; | |
/* Set this as desired */ | |
var desired_WPM = 150; |
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
(function(){var m = "@-webkit-keyframes super-rainbow { 0% { -webkit-filter:hue-rotate(1deg); } 100% { -webkit-filter:hue-rotate(360deg); } } html { -webkit-animation: super-rainbow 2s linear infinite normal }"; | |
var styletag = document.createElement("style"); | |
styletag.textContent = m; | |
document.body.appendChild(styletag); | |
}()); |
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
/* | |
Recursively searches the document, and the iframes within it for elements. | |
Usage: exactly like jQuery() or $() | |
*/ | |
var $$$ = function(thing, doc) { | |
var res = $(thing, doc); | |
$("iframe", doc).each( function(){ | |
res = res.add( $$$(thing, this.contentDocument) ); | |
}); |
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
PS1=$'\n\[\e[1;32m\]\xe2\x94\x8c[ \[\e[1;37m\]\u\[\e[32m\]@\[\e[1;37m\]\h\[\e[32m\] ]\xe2\x94\x80\xe2\x94\x80( \[\e[37m\]\w\[\e[32m\] )\n\xe2\x94\x94\xe2\x94\x80[\[\e[0;31m\]>>> \[\e[0m\]' |
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 pygame, sys, time, random, math | |
from pygame.locals import * | |
# this paragraph is just your standard pygame stuff | |
pygame.init() | |
screen_width = 640 | |
screen_height = 480 | |
screen = pygame.display.set_mode((screen_width, screen_height), RESIZABLE, 32) | |
pygame.display.set_caption("Shooter test") | |
screen.fill((0, 0, 0)) |
NewerOlder