Skip to content

Instantly share code, notes, and snippets.

View sysr-q's full-sized avatar
💾
Hacking the planet.

Chris sysr-q

💾
Hacking the planet.
  • Auckland, New Zealand
  • 02:36 (UTC +12:00)
View GitHub Profile
from urllib import unquote
def magnet_uri(uri):
bits = uri.split("magnet:?")
if len(bits) != 2:
raise ValueError("Not a valid magnet URI.")
result = {}
params = bits[1].split("&")
for param in params:
# This'll bubble up an exception.
@sysr-q
sysr-q / VersionComparator.groovy
Created June 9, 2020 22:56 — forked from founddrama/VersionComparator.groovy
a version comparator (e.g., "1.0.2" < "1.0.10")
def versions = []
def f = new File('mock-version-tags.txt')
f.eachLine { versions << it }
def versionComparator = { a, b ->
def VALID_TOKENS = /._/
a = a.tokenize(VALID_TOKENS)
b = b.tokenize(VALID_TOKENS)
for (i in 0..<Math.max(a.size(), b.size())) {
package main
import (
"fmt"
"flag"
)
func help(args []string) {
help := []string{
"YO",
@sysr-q
sysr-q / what
Created January 23, 2014 03:14
zed at deku in ~/go/src/github.com/plausibility/gitsby on master?
± go build 14:11:23
gitsby.go:7:2: cannot find package "github.com/hoisie/web" in any of:
/usr/lib/go/src/pkg/github.com/hoisie/web (from $GOROOT)
($GOPATH not set)
gitsby.go:9:2: cannot find package "github.com/plausibility/gitsby/server" in any of:
/usr/lib/go/src/pkg/github.com/plausibility/gitsby/server (from $GOROOT)
($GOPATH not set)
zed at deku in ~/go/src/github.com/plausibility/gitsby on master?
± echo $GOPATH 14:13:49
@sysr-q
sysr-q / decrypt.py
Created January 21, 2014 11:30
YOLO SWAG
text = input()
def decrypt(text):
plaintext = []
for word in text.split():
w, w1 = [], []
# Chunk letters
letters = word.split("$$$$")
for i, c in enumerate(letters):
if i%2:
if c == "$w@G":
@sysr-q
sysr-q / c1.py
Created December 30, 2013 07:06
You ever write code and just wonder where it all went wrong?
#!/usr/bin/env python3
print(
(lambda λ: (λ.translate))(input("λ "))(
((lambda Λ:
(lambda Γ:
(lambda ω, ϒ:
ω(ϒ, ϒ[2:] + ϒ[:2])) (Γ.maketrans, Λ))("Σ")
)((lambda π:
(lambda α, Ω:
getattr(α, Ω))(π, "ascii_lowercase")
Only in /home/[redacted]/snapchat-4.1.01/out/com/snapchat/android: brief.diff
diff -r /home/[redacted]/snapchat-4.1.01/out/com/snapchat/android/camera/CameraPreviewFragment$10$1.smali android/camera/CameraPreviewFragment$10$1.smali
29c29
< .line 486
---
> .line 487
43c43
< .line 488
---
> .line 489
/home/zed/.local/bin/wineprefix: line 24: [[: C:\osu\osu!.exe: syntax error in expression (error token is ":\osu\osu!.exe")
fixme:thread:SetThreadStackGuarantee (0x32fc58): stub
err:ole:CoGetContextToken apartment not initialised
fixme:shell:URL_ParseUrl failed to parse L"System"
fixme:process:FlushProcessWriteBuffers : stub
fixme:shell:URL_ParseUrl failed to parse L"mscorlib.resources"
fixme:shell:URL_ParseUrl failed to parse L"mscorlib.resources"
fixme:imm:ImmDisableIME (-1): stub
fixme:thread:NtQueryInformationThread Cannot get kerneltime or usertime of other threads
fixme:thread:NtQueryInformationThread info class 9 not supported yet
ircd@clarity:~/ircd/etc$ head ircd.motd
+------------------------------------------------+
| _ _ |
| _ (/\ DONGCORP IRC /\) |
| /\) \ \ hub.dongcorp.org / / _ |
| / / (Y ) _ ( Y) (/\ |
| ( Y) "" /\) admin: zed "" \ \ |
| "" / / "the lone oper~" (Y ) |
| ( Y) "" |
| "" |
def _markov_split(self, message, chain_length):
words = message.split()
if len(words) < chain_length:
return
words.append(self.stop_word)
for i in xrange(len(words) - chain_length):
yield words[i:i + chain_length + 1]
def _markov_add(self, ebooks, message, chain_length):
s = self.markov[ebooks]