Skip to content

Instantly share code, notes, and snippets.

@doctaphred
doctaphred / ntfs-filenames.txt
Last active March 24, 2025 08:51
Invalid characters for Windows filenames
Information from https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file :
Use any character in the current code page for a name, including Unicode
characters and characters in the extended character set (128–255), except
for the following:
- The following reserved characters:
< (less than)
> (greater than)
;; Time-stamp: <2017-06-23 17:16:36 kmodi>
;; Anonymous function aka lambda macro
;; v1 - Original
;; https://ekaschalk.github.io/post/xi-macro/
(require 'dash)
(require 's)
(defmacro xi (&rest FORMS)
`(lambda ,(--filter (s-contains? (symbol-name it)
@priyadarshan
priyadarshan / git-mv-with-history
Created May 20, 2017 12:00 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@priyadarshan
priyadarshan / locale.txt
Last active May 8, 2017 15:44
Add UTF-8 locale - FreeBSD
# In /etc/login.conf, add
$ diff -u /usr/src/etc/login.conf /etc/login.conf
--- /usr/src/etc/login.conf 2011-03-10 13:48:59.000000000 -0800
+++ /etc/login.conf 2011-05-08 16:44:01.000000000 -0700
@@ -26,7 +26,7 @@
:passwd_format=md5:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
- :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\
@priyadarshan
priyadarshan / .xmodmap
Last active May 8, 2017 15:20
Change keyboard to have C-M-S and Hyper
! To reset:
! setxkbmap -layout us
! Alt -> Ctrl
! Win -> Meta
! Ctrl -> Super
! Caps-lock -> Hyper
clear Lock
clear Control
#!/usr/bin/env bash
# Time-stamp: <2017-04-27 09:57:21 kmodi>
#
# Example of using getopt to parse command line options
# http://stackoverflow.com/a/29754866/1219634 Limitation: All the options
# starting with - have to be listed in --options/--longoptions, else getopt will
# error out. So this cannot be used in wrapper scripts for other applications
# where you plan to pass on the non-wrapper-script options to that wrapped
# application.
@priyadarshan
priyadarshan / PolicyKit.conf
Last active December 28, 2021 18:00
FreeBSD 11 notebook installation cheat-sheet
# /usr/local/etc/PolicyKit/PolicyKit.conf
# Allow normal users to mount removable media automatically
<config version="0.1">
<match action="org.freedesktop.hal.storage.mount-removable">
<return result="yes"/>
</match>
<match action="org.freedesktop.hal.storage.mount-fixed">
<return result="yes"/>
</match>
@priyadarshan
priyadarshan / sockets.txt
Created February 23, 2017 12:36
Common lisp sockets
Source: http://www.huuii.com/people/juan/1301
I want to use sockets under common lisp, so I am going to create a two simple functions the first one serve-socket and the second client-socket, I am going to use usocket library.
- Load the library:
(ql:quickload "usocket")
- Change to usocket library
(in-package :usocket)
@priyadarshan
priyadarshan / sitemap.lisp
Created February 23, 2017 12:33
Generate a sitemap using cxml library
(defun generate-sitemap (urls)
"Creates the sitemap file"
(with-open-file (file "/tmp/sitemap.xml"
:direction :output
:element-type :default
:if-exists :supersede)
(cxml:with-xml-output (cxml:make-octet-stream-sink file :indentation 1 :canonical nil)
(cxml:with-element "urlset"
(cxml:attribute "xmlns" "http://www.sitemaps.org/schemas/sitemap/0.9")
;; create the tags
@ilanKeshet
ilanKeshet / git-mv-with-history
Last active January 3, 2023 16:37 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# credit: foked from https://gist.github.com/emiller/6769886 emiller/git-mv-with-history
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.