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
#!/usr/bin/env zsh | |
# -*- coding: utf-8 -*- | |
# The only differences I observed in the behavior of variable | |
# expansion were around how newlines and spaces are treated ("word | |
# splitting"). When word splitting is performed, newlines are turned | |
# into spaces, and consecutive spaces are collapsed into a single one. | |
# | |
# I never observed any issue with unicode characters, or special | |
# characters that are significant to the shell in regular syntax - |
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 simple wrapper. | |
// | |
// In Java: | |
// | |
// static String getString(String key); | |
// | |
// Calls the C++ function: | |
// | |
// C++: std::string openmpt::string::get(std::string &key); | |
// |
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
package org.example | |
import java.io.File | |
import java.util.* | |
typealias ResultType = String | |
interface Processor<T : Any> { | |
fun getType(): Class<T> |
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
package org.example | |
import kotlinx.coroutines.Dispatchers.IO | |
import kotlinx.coroutines.async | |
import kotlinx.coroutines.awaitAll | |
import kotlinx.coroutines.runBlocking | |
import kotlinx.coroutines.withContext | |
import java.util.concurrent.Executors | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.suspendCoroutine |
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
# Some ~/.ssh/config things I've been experimenting with. | |
# | |
# I need to ssh to a host (bastion) on a public IP address, and then proxy | |
# through that host to reach another host (inner, private IP 10.0.0.53). | |
# | |
# This method allows me to: | |
# | |
# 1. Keep my private ssh key local (not stored on bastion) | |
# 2. Avoid using agent forwarding (for strict control of how my key | |
# can be used) |
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
extern crate cairo; | |
use std::fs::File; | |
use std::error::Error; | |
fn main() -> Result<(), Box<dyn Error>> { | |
let surface = cairo::ImageSurface::create(cairo::Format::ARgb32, 640, 480)?; | |
let context = cairo::Context::new(&surface); // Borrows `surface` (immutable!) |
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
if [[ ! -z $SSH_AUTH_SOCK ]]; then | |
# echo "zshrc.d/ssh-agent: warning: SSH_AUTH_SOCK is set; skipping agent setup" | |
else | |
eval $(ssh-agent -s) | |
trap 'test -n "$SSH_AGENT_PID" && eval `/usr/bin/ssh-agent -k`' 0 | |
fi |
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
#!/usr/bin/env jython | |
import sys | |
sys.path.append('bcprov-jdk15on-160.jar') | |
sys.path.append('bcpg-jdk15on-160.jar') | |
import itertools | |
from org.python.core.io import StreamIO |
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
private val loadJob: Job? = null | |
fun onClick() { | |
loadJob?.cancel() | |
loadJob = async(UI) { | |
val image = loadImage() // suspend fun loadImage | |
imageView.image = image | |
} | |
} |
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
[alias] | |
aheadbehind = !"f() { against=${1:-master}; git rev-list --left-right --count $against...HEAD | awk '{print \"You are \" $2 \" commit(s) ahead of '$against' and \" $1 \" commit(s) behind\"}'; }; f" |
NewerOlder