Skip to content

Instantly share code, notes, and snippets.

@waltarix
waltarix / ash_profile
Last active Jul 7, 2019
ash profile for Alpine Linux Docker image
View ash_profile
# vim: ft=sh
# docker run --rm -it -v =(curl -s https://gist.githubusercontent.com/waltarix/f1d2046dc93ec61721bcd2cacd7d48f8/raw/af8fd9cbfb40bf79d0113f3a436c9e57d01a0a4b/ash_profile):/etc/profile alpine:3.9 ash -l
# or
# docker run --rm -it -v =(curl -s https://git.io/fjity):/etc/profile alpine:3.9 ash -l
export CHARSET=UTF-8
export PAGER=less
cat <<ZONE | base64 -d | gzip -d > /etc/localtime
@waltarix
waltarix / wcwidth9.h
Last active Mar 19, 2020
custom wcwidth9.h
View wcwidth9.h
#ifndef WCWIDTH9_H
#define WCWIDTH9_H
#include <stdlib.h>
#include <stdbool.h>
struct wcwidth9_interval {
long first;
long last;
};
@waltarix
waltarix / migemo.c
Created Mar 4, 2017
migemo function for sqlite3
View migemo.c
/*
* Written by Alexey Tourbin <at@altlinux.org>.
*
* The author has dedicated the code to the public domain. Anyone is free
* to copy, modify, publish, use, compile, sell, or distribute the original
* code, either in source code form or as a compiled binary, for any purpose,
* commercial or non-commercial, and by any means.
*/
#include <assert.h>
#include <stdlib.h>
@waltarix
waltarix / pandoc-fix-textile-writer-for-redmine.patch
Created Oct 13, 2016
pandoc: Fix textile writer for Redmine.
View pandoc-fix-textile-writer-for-redmine.patch
diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs
index 98f9157..8e086e1 100644
--- a/src/Text/Pandoc/Writers/Textile.hs
+++ b/src/Text/Pandoc/Writers/Textile.hs
@@ -40,13 +40,13 @@ import Text.Pandoc.Templates (renderTemplate')
import Text.Pandoc.XML ( escapeStringForXML )
import Data.List ( intercalate )
import Control.Monad.State
-import Data.Char ( isSpace )
@waltarix
waltarix / peco_select_history
Last active Aug 29, 2015
peco_select_history for zsh
View peco_select_history
# vim:ft=zsh
whence peco &>/dev/null && function {
function peco_select_history {
emulate -L zsh
local delimiter=$'\0; \0' newline=$'\n'
BUFFER=${"$(print -rl ${history//$newline/$delimiter} | peco --query "$LBUFFER")"//$delimiter/$newline}
CURSOR=$#BUFFER
View ssssss.txt
                
                
                
              
@waltarix
waltarix / runemacs.bat
Created Feb 25, 2013
emacs launcher for windows
View runemacs.bat
@ECHO OFF
SET HOME=%~dp0
START /B %HOME%/bin/runemacs.exe
@waltarix
waltarix / nacci.php
Created Feb 25, 2013
Fibo, Tribo and Tetra nacci number, Lucas number in PHP
View nacci.php
<?php
const CALC_LIMIT = 1000;
// fibo
var_dump(implode(', ', nacci(CALC_LIMIT, [0, 1])));
// tribo
var_dump(implode(', ', nacci(CALC_LIMIT, [0, 0, 1])));
@waltarix
waltarix / httpstatus.zsh
Created Feb 24, 2013
implementation of httpstatus in zsh
View httpstatus.zsh
function httpstatus {
local -A statuscode
statuscode=(
100 'Continue'
101 'Switching Protocols'
102 'Processing' # RFC 2518 (WebDAV)
200 'OK'
201 'Created'
202 'Accepted'
203 'Non-Authoritative Information'
You can’t perform that action at this time.