Git pull etc. do not preserve hardlinks.
I sometimes need hardlinks inside repo, point to somewhere outside, so I wrote these scripts to manage hardlinks.
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 python3 | |
import subprocess, time, os | |
import json | |
sleep = 10 | |
outfile = "/tmp/hddtemp_input" | |
tmpfile = f"{outfile}.tmp" | |
while True: | |
proc = subprocess.run(["sensors", "-j", "drivetemp-scsi-*-*"], capture_output=True) |
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
<?php | |
require 'dbconf.php'; | |
$db = new mysqli($dbhost, $dbuser, $dbpw, $dbname); | |
if ($db->connect_error) | |
die("Connection failed: " . $db->connect_error . "\n"); | |
$db->set_charset('utf8mb4'); | |
$name = basename($_SERVER['SCRIPT_FILENAME'], ".php"); | |
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
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 <stdio.h> | |
#include <inttypes.h> | |
#define NONE 0 | |
#define BLUE 1 | |
#define GREEN 2 | |
#define RED 3 | |
int getRGB(void) | |
{ |
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
SHELL := /bin/bash | |
.PHONY: run | |
run: ap | |
time ./$< | |
ap: ap.o | |
$(CXX) -o $@ $^ -O3 | |
%.o: %.cpp |
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
*/ |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
int main(int argc, char *argv[]) | |
{ | |
if (argc != 3) | |
return 1; | |
int seq_size = atoi(argv[1]); | |
int repeat = atoi(argv[2]); |
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 | |
declare -a sum file | |
cksum="$(eval sha1sum $(find . -type f -printf '"%p"\n'))" | |
sum=($(echo "$cksum" | cut -d\ -f 1)) | |
eval file=($(echo "$cksum" | cut -d\ -f 3- | awk '{print "\""$0"\""}')) | |
for ((i=1;i<${#sum[@]};i++)); do | |
for ((j=0;j<i;j++)); do | |
if [ "${sum[i]}" == "${sum[j]}" ]; then | |
echo "${sum[i]} | ${file[i]} | ${file[j]}" #; rm "${file[i]}" |
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
MANIFEST_URL ?= https://launchermeta.mojang.com/mc/game/version_manifest.json | |
.DELETE_ON_ERROR: | |
.PHONY: manifest | |
manifest: | |
curl -s -o version_manifest.json -L $(MANIFEST_URL) | |
$(MAKE) JSON_URL="`jq -r < version_manifest.json '.versions|.[]|.url' | xargs`" versions | |
VERSIONS := $(basename $(notdir $(JSON_URL))) |
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
IN := $(sort $(wildcard pages/front*.png)) | |
IN += $(sort $(wildcard pages/prelim*.png)) | |
IN += $(sort $(wildcard pages/page*.png)) | |
OUT := $(IN:%.png=%.pdf) | |
PDF := $(shell basename "$$PWD" | sed 's/ /\\ /g').pdf | |
.PHONY: all | |
all: $(PDF) |
NewerOlder