Skip to content

Instantly share code, notes, and snippets.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pdbws.renderer;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@ulikoehler
ulikoehler / x.pl
Last active December 14, 2015 04:09
Option parsing
#Parse CLI arguments
use Getopt::Std;
my %options=();
getopts("f:d:t:l:o:",\%options);
my $pdbId = %options{f};
my $contactDistance = %options{d};
my $atomType = %options{t};
my $localContactSequenceDist = %options{l};
my $outputFile = %options{o} || "sscc.jpg";
die "No pdb id\n" unless $pdbId;
void* zsocket_new_bind(zctx_t* context, int type, const char* endpoint) {
assert(context);
assert(endpoint);
void* sock = zsocket_new(context, type);
if(unlikely(!sock)) {
return NULL;
}
if(unlikely(zsocket_bind(sock, endpoint) == -1)) {
zsocket_destroy(context, sock);
Least common multiple exercise: https://youtube.com//watch?v=znmPfDfsir8
Figuring out angles between transversal and parallel lines | Geometry | Khan Academy: https://youtube.com//watch?v=2WjGD3LZEWo
Thinking about whether an expression is positive or negative: https://youtube.com//watch?v=mmWbK2xmJPQ
Triangle area proofs | Perimeter, area, and volume | Geometry | Khan Academy: https://youtube.com//watch?v=YOYQys52sPs
Solving ratio problems with tables exercise 3: https://youtube.com//watch?v=dmcVzFbXMCU
Rotation of polygons example: https://youtube.com//watch?v=Hur3v1hrX3U
Adding subtracting mixed numbers 0.5 (ex 1): https://youtube.com//watch?v=EGy1W24EPEI
Volume of a sphere | Perimeter, area, and volume | Geometry | Khan Academy: https://youtube.com//watch?v=IelS2vg7JO8
Powers of fractions: https://youtube.com//watch?v=oEgeUk_Ix2c
Converting decimals to percents (ex 2): https://youtube.com//watch?v=3_caioiRu5I
@ulikoehler
ulikoehler / yttimedtext.py
Created August 2, 2015 14:48
Does a video have subtitles on YT?
#!/usr/bin/env python3
import requests
def hasTimedText(v, lang="de"):
url = "https://www.youtube.com/api/timedtext?caps=asr&key=yttt1&v=%s&lang=%s&fmt=srv2" % (v, lang)
response = requests.get(url)
return bool(response.text) # Empty if not available
if __name__ == "__main__":
print(hasTimedText("Y6JsEja15Vk"))
// ==UserScript==
// @name KA Crowdin Translation Tools
// @namespace kadeutsch.org/kacrowdintools
// @include https://crowdin.com/translate/khanacademy/*
// @include https://translate.khanacademy.org/translate/*
// @description Various keyboard shortcuts to make KA translation on crowdin a little bit easier
// @version 0.5.2
// @grant none
// @author Alain Schaefer & Uli Köhler
// @updateURL https://gist.githubusercontent.com/alani1/a62cd694ba35ed11744e/raw/KATranslationTools.user.js
@ulikoehler
ulikoehler / Makefile
Last active August 29, 2015 14:27
LevelDB FUSE filesystem (pre-alpha)
all:
gcc -Wall levelfs.cpp `pkg-config fuse --cflags --libs` -o levelfs
@ulikoehler
ulikoehler / po.patch
Created October 21, 2015 22:18
KA PO patch
diff --git a/poentry_linter.py b/poentry_linter.py
index e748d35..251555b 100644
--- a/poentry_linter.py
+++ b/poentry_linter.py
@@ -136,6 +136,9 @@ def _assert_same(po_entry, regexp, ka_locale, munge_fn=None):
for s in set(english_singular_counts.keys() +
english_plural_counts.keys() +
translated_counts.keys()):
+ # Hotfix for '"" occurs n times [...]' bug
+ if not s:
# On public server:
socat -,raw,echo=0 tcp-listen:12345
# On private computer
socat tcp:localgrid.de:12345 'exec:"bash -i",pty,stderr,setsid,sigint,sane'
using System;
namespace MathNet.Numerics
{
public struct Quaternion64 {
public double w, x, y, z;
public double NormSquared {
get {
return w * w + x * x + y * y + z * z;