Skip to content

Instantly share code, notes, and snippets.

@mutsune
mutsune / eot.c
Created January 15, 2020 09:09
Y2038
#include <stdio.h>
#include <time.h>
#include <limits.h>
#include <math.h>
int main(void)
{
time_t t = time(NULL);
time_t end = 2147483647;
use std::f32;
use std::fmt;
fn main() {
let (x, y, z) = (1., 2., 3.);
let result: String = match triangle(x, y, z) {
Some(x) => x.to_string(),
_ => "insufficient".to_string(),
};
println!("{}", result);
import cv2
img = cv2.imread("input.png")
tmpl = cv2.imread("tmpl.png")
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
tmpl = cv2.cvtColor(tmpl, cv2.COLOR_RGB2GRAY)
match = cv2.matchTemplate(img, gray, cv2.TM_SQDIFF_NORMED)
:root {
--multirow-n-rows: 3;
}
#tabbrowser-tabs {
min-height: unset !important;
padding-inline-start: 0px !important;
}
#tabbrowser-tabs > .tabbrowser-arrowscrollbox > .arrowscrollbox-scrollbox {
display: flex;
flex-wrap: wrap;
@mutsune
mutsune / reading_list_on_chrome.scpt
Last active April 24, 2019 04:33
Add a opening tab on Chrome into Safari's Reading List
tell application "Google Chrome"
set myURL to get URL of active tab of first window
set myTitle to get title of active tab of first window
end tell
tell application "Safari" to add reading list item myURL with title myTitle
@mutsune
mutsune / darkmode.sh
Created January 17, 2019 04:37
enable/disable Dark Mode scripts
function enable_darkmode() {
set_darkmode "$1" "no"
}
function disable_darkmode() {
set_darkmode "$1" "yes"
}
function set_darkmode() {
app="$1"
@mutsune
mutsune / pattern1
Last active January 16, 2019 14:35
Day-O preference
MM/dd(EEEEE) HH:mm:ss.S
trap '
pids="$(jobs -p)"
if [[ "${pids}" != "" ]]; then
echo "terminated procs are below:"
ps auxww ${pids}
kill ${pids} > /dev/null
fi' EXIT
@mutsune
mutsune / segfault.c
Created December 17, 2018 07:53
Segmentation fault: 11
#include <stdio.h>
int main(int argc, char **argv)
{
unsigned long a[1];
a[3] = 0x7ffff7b36cebUL;
return 0;
}
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main() {
int fd;
char buf[2];
fd = open("filename.txt", 2);