Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
ADJUST="10"
DB_NAME="your_table"
DUMP_LOCATION="/tmp"
cd ${DUMP_LOCATION} || exit 0
mysqldump -uroot ${DB_NAME} > $(date "+%Y%m%d").dump
nice -n ${ADJUST} find . -mtime +5 -path "2*.dump" -exec rm -f {} \;
use v6;
my $s = IO::Socket::INET.new(:host<ecosystem-api.p6c.org>, :port(80));
$s.print("GET /projects.json HTTP/1.0\r\nHost: ecosystem-api.p6c.org\r\n\r\n");
my $got = $s.get;
say $got;
public class Sig {
public static void main(String... args) {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
System.out.println("java finished");
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#ifdef __SSE4_2__
#ifdef _MSC_VER
#include <nmmintrin.h>
#else
#include <x86intrin.h>
package net.moznion.jesque.worker;
import lombok.extern.slf4j.Slf4j;
import net.greghaines.jesque.Config;
import net.greghaines.jesque.ConfigBuilder;
import net.greghaines.jesque.Job;
import net.greghaines.jesque.client.Client;
import net.greghaines.jesque.client.ClientImpl;
import net.greghaines.jesque.worker.JobFactory;
import net.greghaines.jesque.worker.MapBasedJobFactory;
package net.moznion;
import me.geso.nanobench.Benchmark;
import me.geso.nanobench.Benchmark.Bench;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
public class BenchmarkRandom {
public static class RandomNumberGenerator extends Thread {
enum LowerCaseLetter {
a, b, c;
private static final List<LowerCaseLetter> VALUES = Arrays.asList(values());
private static final int SIZE = VALUES.size();
private static final Random RANDOM = new Random();
public static String getRandomLetter() {
return VALUES.get(RANDOM.nextInt(SIZE)).toString();
}
}
package me.geso.routes;
import java.util.LinkedHashMap;
public class PathRouteBench {
public void benchPathRoute() {
for (int i = 0; i < 1_000_000; ++i) {
PathRoute<String> route = new PathRoute<String>("/foo/*", "Detail");
LinkedHashMap<String, String> captured = new LinkedHashMap<>();
boolean matched = route.match("/foo/bar/baz", captured);
import java.util.Formatter;
public class Bench {
private String fileName = "foo.java";
private String className = "class.dayo";
private String methodName = "methodDayo";
private int lineNumber = 42;
public void benchStringBuilder() {
for (int i=0; i<1_000_000; ++i) {
.DEFAULT_GOAL := watch
thesis.dvi: thesis.tex
platex thesis.tex
thesis.pdf: thesis.dvi
dvipdfmx -f texfonts.map thesis.dvi
watch:
./script/watcher --dir ./thesis.tex -- make thesis.pdf