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
(let ((files (file-expand-wildcards "init-lisp/init-*.el"))) | |
(mapc | |
(lambda (f) | |
(with-current-buffer (find-file-noselect f) | |
(indent-region (point-min) (point-max)) | |
(save-buffer))) | |
files)) |
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
;;; packages-update-interactive.el --- Simple tools for upgrading Emacs packages interactively | |
;; -*- lexical-binding: t -*- | |
;;; Commentary: | |
;;; Code: | |
(require 'package) | |
(require 'time-date) | |
(defcustom package-refresh-interval 2 | |
"DAYS until `package-refresh-contents'." |
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
(require 'calc-misc) | |
(defun last-elem (list) | |
(car (last list))) | |
(defun pow (num pow) | |
(if (floatp pow) | |
(error "No float")) | |
(if (zerop pow) |
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
(defun goimports-buffer () | |
"Format current buffer with goimports." | |
(interactive) | |
(let ((gofmt-command-bak gofmt-command) | |
(gofmt-args-bak gofmt-args)) | |
(setq gofmt-command "goimports" | |
gofmt-args nil) | |
(with-current-buffer (current-buffer) | |
(gofmt)) | |
(setq gofmt-command gofmt-command-bak |
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 ( | |
"bufio" | |
"crypto/tls" | |
"fmt" | |
"log" | |
"net" | |
"os" | |
"strings" |
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
// BSD Zero Clause License | |
// | |
// Copyright (c) 2022 qxxt | |
// | |
// Permission to use, copy, modify, and/or distribute this software for | |
// any purpose with or without fee is hereby granted. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL | |
// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED | |
// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
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
// Get first 10th line | |
// x := trimByteLine(b, 10, false) | |
// | |
// Get last 20th line | |
// y := trimByteLine(b, 20, true) | |
func trimByteLine(b []byte, maxL int, reverse bool) []byte { | |
line := 0 | |
byteLen := len(b) - 1 | |
if reverse { |
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://go.dev/play/p/qKDFxiJQAfF | |
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
someBytes := []byte(`Lorem ipsum dolor sit amet, | |
consectetur adipiscing elit. |
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
@mixin clamp-calc ( | |
$property, | |
$min-size, | |
$max-size, | |
$min-screen-width: 320px, | |
$max-screen-width: 1280px | |
) { | |
$min-screen-width-rem: $min-screen-width / 16px * 1rem; | |
$max-screen-width-rem: $max-screen-width / 16px * 1rem; | |