Skip to content

Instantly share code, notes, and snippets.

@tarleb
tarleb / interactive.lua
Last active September 29, 2024 21:18
Helper function for interactive Lua filters
function interactive (it, env)
local has_readline, RL = pcall(require, 'readline')
if not has_readline then
RL = {
readline = function (prompt)
io.stdout:write(prompt)
return io.read()
end
}
@GrantBirki
GrantBirki / tarkov-time-python.py
Created March 1, 2022 07:49
Tarkov Time in Python
from datetime import datetime
# 7 seconds for every one second in real time
TARKOV_RATIO = 7
def real_time_to_tarkov_time(time, left = True):
"""
Convert real time to Tarkov time
:param time: Current UTC epoch in milliseconds -> int(datetime.datetime.utcnow().timestamp()) * 1000
:param left: True if left side, False if right side (Think eft in-game clock)
@equinox79
equinox79 / フォルダ内のdocxからpdf生成(pdfないものだけ)※右クリックして「Powershellで実行」.ps1
Created November 24, 2021 06:49
フォルダ内のdocxからpdf生成(pdfないものだけ)※右クリックして「Powershellで実行」
$word = NEW-OBJECT -COMOBJECT WORD.APPLICATION
Write-Host "[フォルダ内のdocxからpdfを生成します]"
$files = Get-ChildItem | Where-Object{$_.Name -match "docx$"}
Write-Host "[変換開始]"
foreach($file in $files)
{
try
{
$result = (Test-Path $file.FullName.Replace(".docx",".pdf"))
@AnchorBlues
AnchorBlues / dict_vs_XXX.py
Created May 19, 2021 02:34
辞書の代わりに用いることが出来るオブジェクト比較
from collections import namedtuple
from typing import NamedTuple
from dataclasses import dataclass, asdict
# Python 3.7.3 で検証
D = namedtuple('D', ('a', 'b', 'c'))
# 一部のメンバだけデフォルト値指定、というのができない? また、mypyに怒られる(正式な書き方じゃない?)。
D.__new__.__defaults__ = (1, None, 0)
@sonkm3
sonkm3 / Dockerfile
Created February 12, 2021 08:27
Raspberry Pi pico用のMicroPythonを手元でビルドするメモ
FROM debian:buster
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
cmake \
build-essential \
binutils-arm-none-eabi \
gcc-arm-none-eabi \
libnewlib-dev \
@lierdakil
lierdakil / filter.hs
Created July 10, 2018 06:59
Pandoc filter to replace internal links with page references
import Text.Pandoc.JSON
import Data.List
main :: IO ()
main = toJSONFilter myfilter
myfilter (Link _ text (url, _))
| '#':ref <- url
= Span nullAttr $
text <>
@tk0miya
tk0miya / tk0miya-sponsors-2021.md
Last active September 23, 2021 13:25 — forked from melpon/wandbox-sponsors.md
@tk0miya のスポンサー募集

(For English readers: please read https://github.com/sponsors/tk0miya instead)

@tk0miya の企業・個人スポンサーを募集します

@tkomiya は、日本在住の OSS 開発者です。
趣味として Sphinxpycmarkblockdiag などの OSS の開発やメンテナンスに携わっています。

ここ数年の活動の中心は Sphinx です。 Sphinx は PythonLinux カーネルをはじめとして、数多くの OSS のドキュメントに利用されているドキュメンテーションツールです。 Sphinx プロジェクトはごく少人数のメンテナによって活動しており、(明確な役割として定義はされていないものの) リードメンテナ、メインメンテナとして活動しています。

Lua言語入門

Hello World

コードを書く

print("hello World!!\")

拡張子は.lua としてファイルを保存

@noahcoad
noahcoad / yaml2json.py
Last active December 27, 2019 22:46
Python to Convert yaml to json
# convert yaml to json
# pip3 install pyyaml
# http://pyyaml.org/wiki/PyYAMLDocumentation
# py3 yaml2json.py < ~/code/manpow/homeland/heartland/puphpet/config.yaml
# gist https://gist.github.com/noahcoad/51934724e0896184a2340217b383af73
import yaml, json, sys
sys.stdout.write(json.dumps(yaml.load(sys.stdin), sort_keys=True, indent=2))
@evanwill
evanwill / gitBash_windows.md
Last active October 24, 2024 17:27
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so