Skip to content

Instantly share code, notes, and snippets.

View MihailJP's full-sized avatar

MihailJP MihailJP

View GitHub Profile
@MihailJP
MihailJP / d_copy.lua
Created October 22, 2012 14:47
Shallow- and deep-copy of table in Lua
function clone (t) -- deep-copy a table
if type(t) ~= "table" then return t end
local meta = getmetatable(t)
local target = {}
for k, v in pairs(t) do
if type(v) == "table" then
target[k] = clone(v)
else
target[k] = v
end
@MihailJP
MihailJP / gpufan.bash
Created November 5, 2013 13:02
Script to control the fan speed automatically (works only for NVIDIA graphic cards)
#!/bin/bash
# Script to control the fan speed automatically
setFanSpeed() {
eval "nvidia-settings -a GPUFanControlState=1 -a [fan:0]/GPUCurrentFanSpeed=$1 > /dev/null"
}
cleanup() {
eval "nvidia-settings -a GPUFanControlState=0"
@MihailJP
MihailJP / bdf.xml
Created July 13, 2024 02:20
Notepad++ syntax highlighting definition file for BDF
<NotepadPlus>
<UserLang name="Glyph Bitmap Distribution Format" ext="bdf" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments"></Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@MihailJP
MihailJP / sfd.xml
Created July 13, 2024 02:19
Kate syntax highlighting definition file for FontForge SFD
<?xml version="1.0" encoding="UTF-8"?>
<language name="Spline Font Database" section="Other" version="1.00" extensions="*.sfd;*.glyph;font.props;*.bitmap;strike.props" kateversion="3.9" mimetype="application/vnd.font-fontforge-sfd">
<highlighting>
<contexts>
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
<WordDetect String="SplineFontDB:" context="#stay" firstNonSpace="true" attribute="Keyword" beginRegion="SFD"/>
<WordDetect String="EndSplineFont" context="#stay" firstNonSpace="true" attribute="Keyword" endRegion="SFD"/>
<WordDetect String="BeginPrivate:" context="#stay" firstNonSpace="true" attribute="Keyword" beginRegion="Private"/>
<WordDetect String="EndPrivate" context="#stay" firstNonSpace="true" attribute="Keyword" endRegion="Private"/>
<WordDetect String="BeginChars:" context="#stay" firstNonSpace="true" attribute="Keyword" beginRegion="Chars"/>
@MihailJP
MihailJP / bdf.xml
Created July 13, 2024 02:18
Kate syntax highlighting definition file for BDF (bitmap font)
<?xml version="1.0" encoding="UTF-8"?>
<language name="Glyph Bitmap Distribution Format" section="Other" version="1.00" extensions="*.bdf" kateversion="3.9" mimetype="application/x-font-bdf">
<highlighting>
<list name="keywords">
<item> COMMENT </item>
<item> CONTENTVERSION </item>
<item> SIZE </item>
<item> FONTBOUNDINGBOX </item>
<item> METRICSSET </item>
<item> SWIDTH </item>
@MihailJP
MihailJP / fontforge-script.xml
Created July 13, 2024 02:17
Kate syntax highlighting definition file for FontForge legacy script
<?xml version="1.0" encoding="UTF-8"?>
<language name="FontForge script" section="Scripts" version="1.00" extensions="*.pe" kateversion="3.9">
<highlighting>
<list name="block-opening keywords">
<item> if </item>
<item> while </item>
<item> foreach </item>
</list>
<list name="block-separating keywords">
<item> elseif </item>
@MihailJP
MihailJP / hsp.xml
Last active June 27, 2024 11:00
Kate syntax highlighting definition file for Hot Soup Processor
<?xml version="1.0" encoding="UTF-8"?>
<language name="Hot Soup Processor" section="Sources" version="1.01" extensions="*.hsp;*.as" kateversion="3.9">
<highlighting>
<list name="keywords">
<item> await </item>
<item> break </item>
<item> continue </item>
<item> else </item>
<item> end </item>
<item> exec </item>
@MihailJP
MihailJP / PyGitUp.patch
Created June 8, 2024 14:40
PyGitUp workaround for MSYS2/MinGW (for git-up 2.2.0)
--- gitup.py.orig 2023-08-19 22:19:24.904702800 +0900
+++ gitup.py 2024-06-08 23:33:47.171299400 +0900
@@ -33,6 +33,7 @@
import colorama
from git import Repo, GitCmdObjectDB
from termcolor import colored
+from git.exc import NoSuchPathError
# PyGitUp libs
from PyGitUp.utils import execute, uniq, find
@MihailJP
MihailJP / scala.xml
Last active April 19, 2024 01:14
Notepad++ syntax highlighting definition file for Scala
<NotepadPlus>
<UserLang name="Scala" ext="scala" udlVersion="2.0">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" forceLineCommentsAtBOL="no" foldCompact="no" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="yes" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments" id="0">00// 01 02 03/* 04*/</Keywords>
<Keywords name="Numbers, additional" id="1"></Keywords>
<Keywords name="Numbers, prefixes" id="2">0x</Keywords>
@MihailJP
MihailJP / complex.lua
Created August 28, 2012 16:41
Complex numbers for Lua
--[[
--
-- *** Complex numbers for Lua ***
--
--]]
-- Module "cmath" ... mathematic functions for complex numbers
module("cmath", package.seeall)