Skip to content

Instantly share code, notes, and snippets.

@drm
drm / gist:da216840c0da3afab66737b6cdb788c3
Last active September 13, 2024 19:04
keypair encryption using openssl
openssl \
pkeyutl \
-encrypt \
-inkey <(ssh-keygen -f ~/.ssh/id_rsa.pub -e -m pem) \
-pubin \
-in ./foo.txt \
-out foo.enc
openssl \
@drm
drm / BlockingNativeFSLockFactory.java
Created August 26, 2021 13:35
BlockingNativeFSLockFactory.java
package app.lucene;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.io.IOException;

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@drm
drm / fetch-dep.sh
Created March 18, 2019 09:45
Quickly download maven dependencies without using maven.
cat > pom.xml <<-EOF
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>temp</groupId>
<artifactId>temp</artifactId>
<version>master</version>
<dependencies>
<dependency>
<groupId>$1</groupId>
<artifactId>$2</artifactId>
<?php
/**
* @author Gerard van Helden <[email protected]>
* @copyright Zicht Online <http://zicht.nl>
*/
$flags = array_filter($_SERVER['argv'], function($a) {
return $a[0] === '-';
});
$args = array_filter($_SERVER['argv'], function($a) {
@drm
drm / gist:e8857cb7c8d249a6068c
Created May 30, 2015 22:37
Just making a point.
#include <stdio.h>
int main()
{
char c = NULL;
if (c == NULL) {
printf("Yes\n");
}
return 0;
}
<?php
/**
* @author Gerard van Helden <[email protected]>
* @copyright Zicht Online <http://zicht.nl>
*/
require_once 'vendor/autoload.php';
class MyConf implements \Symfony\Component\Config\Definition\ConfigurationInterface
{
<?php
/**
* @author Gerard van Helden <[email protected]>
* @copyright Zicht Online <http://zicht.nl>
*/
require_once 'vendor/autoload.php';
class MyConf implements \Symfony\Component\Config\Definition\ConfigurationInterface
{
@drm
drm / gist:4158455
Created November 28, 2012 01:29
tetris.html
<!doctype html>
<html>
<body>
<pre id="canvas" style="font-size:20px; font-weight:bold;"></pre>
</body>
</html>
<script type="text/javascript">
@drm
drm / gist:3871428
Created October 11, 2012 10:14
bash: split args & opts
#!/usr/bin/env bash
function a {
echo "let's do A!"
}
function b {
echo "Let's do B!"
}