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 java.lang.management.GarbageCollectorMXBean; | |
import java.lang.management.ManagementFactory; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ScheduledExecutorService; | |
import java.util.concurrent.TimeUnit; | |
public class GCMonitor implements Runnable { | |
private final GarbageCollectorMXBean mbean; | |
private long lastGCCount; | |
private long lastGCTime; |
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
const GLib = imports.gi.GLib; | |
const Gio = imports.gi.Gio; | |
let [res, out, err, status] = GLib.spawn_command_line_sync('ls -la'); | |
print(out); | |
let [res, out] = GLib.spawn_command_line_sync('ls -la'); | |
print(out); | |
let [res, out] = GLib.spawn_sync(null, ['/bin/ls', '-la'], null, 0, null); |
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/gjs | |
// SPDX-License-Identifier: MIT | |
// usage: gjs shell_object_sample.js | |
const { GIRepository, GLib, Gio } = imports.gi; | |
function findLib(path, prefix) { | |
const libdir = Gio.File.new_for_path(path); | |
const files = libdir.enumerate_children('', Gio.FileQueryInfoFlags.NONE, null); | |
for (; ;) { |
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
const GLib = imports.gi.GLib; | |
const Gio = imports.gi.Gio; | |
function shell_quote(str) { | |
return "'" + str + "'"; | |
} | |
function chomp(str) { | |
return str.replace(/[\r\n]+$/, ''); | |
} |
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 java.lang.ref.Reference; | |
import java.lang.ref.ReferenceQueue; | |
import java.lang.ref.SoftReference; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ScheduledExecutorService; | |
import java.util.concurrent.TimeUnit; | |
public class SoftRefSample { | |
static class Hoge { | |
final String s; |
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 java.lang.ref.Reference; | |
import java.lang.ref.SoftReference; | |
import java.util.Arrays; | |
import java.util.Date; | |
public class SurelyDerefSoftRefSample { | |
public static void main(String[] args) throws Exception { | |
System.out.println("test1"); | |
test1(); |
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 -- | |
for F in $@ ; do | |
if [ $(tar tf $F | grep -o '^[^/]*/' | sort | uniq | wc -l) -eq 1 ]; then | |
tar xvf $F | |
else | |
D=$F | |
for x in .tgz .tbz .txz .tar.gz .tar.bz2 .tar.xz; do | |
D=$(basename "$D" $x) | |
done |
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 c1606c90445679a04856665942cd6b398d441ff7 Mon Sep 17 00:00:00 2001 | |
From: Taiki Sugawara <buzz.taiki@gmail.com> | |
Date: Fri, 17 Feb 2012 11:32:58 +0900 | |
Subject: [PATCH] Encode utf-8 string. | |
--- | |
edbi-bridge.pl | 34 ++++++++++++++++++++++++++-------- | |
1 files changed, 26 insertions(+), 8 deletions(-) | |
diff --git a/edbi-bridge.pl b/edbi-bridge.pl |
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 java.io.InputStream; | |
import java.io.OutputStream; | |
import java.io.PrintStream; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.List; | |
import java.util.Set; |
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 lombok.Delegate; | |
import java.sql.ResultSet; | |
public class LombokDelegateOnDeprecateSample { | |
private static class MyResultSet { | |
@Delegate private final ResultSet rs; | |
public MyResultSet(ResultSet rs) { | |
this.rs = rs; | |
} | |
} |