$ uname -a
Linux x220 6.3.0-1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.3.7-1 (2023-06-12) x86_64 GNU/Linux
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 | |
set -euo pipefail | |
# Select all objects which do not contain an attribute named 'message'. | |
# | |
# Background: a log file contains messages from an application and | |
# numerous messages from Mongo db; the messages from Mongo contain | |
# an attribute called 'message', the application logs contain 'msg' | |
# instead. Filter the application logs only by selecting all objects |
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
# Grab video from a camcorder using dvgrap, | |
# convert to h.265 encoded video using ffmpeg. | |
# | |
# https://trac.ffmpeg.org/wiki/Encode/H.265 | |
# https://regx.dgswa.com/html/content/dvgrab-ffmpeg-capture-compression | |
dvgrab --format dv1 --rewind - \ | |
| ffmpeg -f dv -i - \ | |
-vf yadif \ | |
-c:v libx265 -crf 26 \ |
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
# DEPRECATED: | |
# In addition to running Python code, the coderpad console allows | |
# to pip install packages as well: | |
# | |
# >>> pip install sortedcontainers | |
# | |
# Using the code below is not required. | |
# It will be kept here for reference, as it shows how to access | |
# the Coderpad environment. |
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 <set> | |
#include <iostream> | |
#include <vector> | |
/* | |
* How to order a set<vector<A>::iterator>. | |
*/ | |
struct A | |
{ |
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
# https://germandiagogomez.medium.com/getting-started-with-meson-build-system-and-c-83270f444bee | |
# Create project directory. | |
mkdir new_project | |
cd new_project | |
# Create source file. | |
echo "int main() {};" >> main.cpp | |
# Init meson, setup meson. |
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 | |
set -euo pipefail | |
# Convert (Nikon/NEF) RAW images to PPM using dcraw; | |
# write results to stdout with -c; | |
# convert stdin to JPG using Imagemagick's convert; | |
# specify format of input image with 'ppm:-'. | |
find /path/to/sdcard/ -name '*.NEF' \ | |
| parallel 'dcraw -c {} \ |
From: https://cromwell-intl.com/open-source/performance-tuning/file-systems.html.
Disable recording of access times when mounting the FS.
For example, find
with access times enabled would upate the access time of every file found.
# /etc/fstab
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
# Oh-My-ZSH custom function to record left monitor from CLI. | |
# | |
# Place in $ZSH/.oh-my-zsh/custom. | |
# | |
# Two monitors at screen 0, the left one connected at DP-1: | |
# | |
# xrandr | |
# Screen 0: minimum 320 x 200, current 3840 x 1200, maximum 16384 x 16384 | |
# DP-1 connected primary 1920x1200+1920+0 (normal left inverted right x axis y axis) 518mm x 324mm | |
# 1920x1200 59.95*+ |
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
# Place in $ZSH/.oh-my-zsh/custom. | |
# | |
# The following ZSH function uses GhostScript's `gs` command to reduce the file size of a PDF file. | |
# The result of compressing `test.pdf` will be written to `test.compressed.pdf`. | |
# If `test.compressed.pdf` exists, it will only be overwritten after confirmation. | |
# | |
# Now, restart/open a new shell and compress PDFs with: | |
# | |
# compress_pdf test.pdf | |
# File exists: test.compressed.pdf, overwrite (Y/n)? |
NewerOlder