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 bash | |
# Overwrite EXIF AllDates(DateTimeOriginal, DateTime, DateTimeDigitized) with photoTakenTime value of sidecar json | |
# The simplest way is to execute the following command, but this method cannot handle the "xxx(1).jpg" / "xxx.jpg(1).json" pair. | |
# $ exiftool -overwrite_original -d "%s" -tagsFromFile "%d/%F.json" "-AllDates<PhotoTakenTimeTimestamp" -r ${DIR} | |
function usage() { | |
cat << EOS | |
usage: $0 [JPG or DIR] |
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 main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"time" | |
"github.com/tarm/serial" | |
) |
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/perl | |
use utf8; | |
use 5.010; | |
use strict; | |
#use autodie; | |
use warnings; | |
#use diagnostics; | |
my $who = `whoami`; |
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
use std::io; | |
mod term { | |
use termios; | |
/// echo off. Return old termios state. | |
pub fn echo_off() -> termios::Termios { | |
let oldstat = termios::Termios::from_fd(0).unwrap(); | |
let mut termstat = oldstat; | |
termstat.c_lflag &= !(termios::ICANON | termios::ECHO); |
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
#include <memory> | |
#include <iostream> | |
#include <opencv2/core.hpp> | |
#include <opencv2/imgcodecs.hpp> | |
#include <opencv2/highgui.hpp> | |
int main() { | |
std::unique_ptr<uint8_t[]> bufl(new uint8_t[320 * 240]); | |
memset(bufl.get(), 0x00, 320*240/2*sizeof(uint8_t)); | |
memset(bufl.get()+320*240/2, 0x44, 320*240/2*sizeof(uint8_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
#!/usr/bin/env bash | |
# This script is to set xrandr as mirroring | |
set -eu | |
DEBUG_ON=0 | |
function log_output() { | |
if [[ $DEBUG_ON -ne 1 || $# -eq 0 ]]; then |
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 sh | |
# | |
# https://www.kernel.org/doc/Documentation/usb/power-management.txt | |
# | |
set -eu | |
USB_DEVICE_COUNTS=5 |
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 sh | |
# | |
# https://www.kernel.org/doc/Documentation/usb/power-management.txt | |
# | |
set -eu | |
function fn_help() { |
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
use std::io; | |
#[derive(Debug)] | |
/// tuple-like struct | |
struct Foo(i32); | |
fn num(n: i32) -> io::Result<i32> { | |
Ok(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
use std::fs::File; | |
use std::io::{self, Seek, SeekFrom}; | |
use std::time::Duration; | |
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; | |
use mio; | |
use mio::unix::{EventedFd, UnixReady}; | |
use nix::poll::{self, PollFd, EventFlags}; | |
use libc::c_int; | |
use super::*; | |
use inotify; |
NewerOlder