This file contains hidden or 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/fish | |
function rename-series --description 'rename-series <series_name> <season_number> <file_extension>' | |
set count 0 | |
for file in * | |
set count (math $count + 1) | |
if test (math $count \< 10) = '1' | |
mv -i -v "$file" "$argv[1] $argv[2]x0$count.$argv[3]" | |
else | |
mv -i -v "$file" "$argv[1] $argv[2]x$count.$argv[3]" | |
end |
This file contains hidden or 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/fish | |
for connection in /sys/class/net/* | |
switch '$connection' | |
case '*lo' | |
continue | |
case '*' | |
if test (cat $connection/operstate) = 'up' | |
set net (basename $connection) | |
set rx (math (cat $connection/statistics/rx_bytes) / 1048576) | |
set tx (math (cat $connection/statistics/tx_bytes) / 1048576) |
This file contains hidden or 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 first obtains a list of episodes in all subdirectories and stores | |
// data about each episode into an episode struct. After the data is collected, | |
// it is stored inside of the Episodes type. After all episodes are gathered, | |
// the program will transcode all of the episodes with H.265 10-bit video and | |
// Opus audio -- storing the transcoded video into a MKV container. Information | |
// is printed as soon as the episode is finished transcoding. | |
package main | |
import "flag" | |
import "fmt" |
This file contains hidden or 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
// gorsync opens a file containing a tab-delimited list of backup entries. | |
// Spaces are allowed, and any number of tabs can be used when formatting the | |
// file. The first entry is the name of the entry, the second is the source | |
// directory, and the third entry is the target directory. After all jobs have | |
// been queued, the program will run them in serial and print to the terminal | |
// when it has completed each entry. | |
// | |
// Ex: Anime Archive /home/mmstick/Videos/Archive /home/mmstick/Backup/ | |
package main |
This file contains hidden or 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
// AMD A4-5000 Quad-Core 1.5GHz APU | |
// GC benchmark | |
// Normal For Loop : 669.966032ms | |
// Double Unrolled Loop: 422.242497ms | |
// Triple Unrolled Loop: 363.525022ms | |
// Quad Unrolled Loop : 281.522688ms | |
// Octo Unrolled loop : 312.757938ms |
This file contains hidden or 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 std.file; | |
import std.stdio; | |
static immutable ulong buffer_size = 1024 * 1024 * 10; | |
// Print the file contents of the file obtained by openFile(). | |
void print(File input) { | |
immutable ulong file_size = input.size(); | |
if (file_size < buffer_size) { | |
ubyte[] buffer; |
This file contains hidden or 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
// C Implementation | |
#include <stdio.h> | |
// A recursive function that returns the GCD of two numbers. | |
int gcd(int x, int y) | |
{ | |
return y == 0 ? x : gcd(y, x % y); | |
} | |
int lcm(int x, int y) |
This file contains hidden or 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 std.stdio; | |
// getSequences() returns the number of sequences to print. | |
int getSequences() | |
{ | |
int sequences; | |
write("Number of sequences: "); | |
readf("%d", &sequences); | |
return sequences; | |
} |
This file contains hidden or 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 | |
find * -type f -name \*.pdf | parallel -j+0 --gnu nice -n 19 gs -sDEVICE=pdfwrite -dCompatabilityLevel=1.4 -dPDFSETTINGS=/ebook -dDetectDuplicateImages=true -dNOPAUSE -dQUIET -dBATCH -sOutputFile="{.}_compressed.pdf" "{}" |
This file contains hidden or 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 | |
gs -sDEVICE=pdfwrite -dCompatabilityLevel=1.4 -dPDFSETTINGS=/ebook -dDetectDuplicateImages=true -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$1" *.pdf |