Skip to content

Instantly share code, notes, and snippets.

@msr1k
msr1k / gos.go
Last active January 25, 2018 05:29
Go file server
package main
import (
"fmt"
"net/http"
"os"
"path/filepath"
)
func main() {
@msr1k
msr1k / NobbutBrowser.pro
Last active August 9, 2017 01:10
NobbutBrowser: Extremely simple web browser
#-------------------------------------------------
#
# Project created by QtCreator 2017-02-06T09:02:49
#
#-------------------------------------------------
QT += core gui webenginewidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@msr1k
msr1k / redirect.rb
Created March 31, 2017 03:11
Extremely simple redirect server program (Overwrite port number and uri_to_redirect to use this)
require 'webrick'
include WEBrick
server = HTTPServer.new(Port: 3_000)
server.mount_proc('/') do |req, res|
res['Pragma'] = 'no-cache'
res.set_redirect(HTTPStatus::MovedPermanently,
"uri_to_redirect#{req.path}")
@msr1k
msr1k / .vimrc
Last active April 13, 2017 04:34
cVim, which is vim as google chrome extension , setting file
set noautofocus
"let scrollstep=50
let blacklists = ["https://feedly.com/*","https://mail.google.com/*","https://outlook.office.com/owa/*","https://twitter.com/"]
map K previousTab
map J nextTab
map \t lastUsedTab
unmap e
@msr1k
msr1k / vifmrc
Last active December 20, 2017 07:58
vifmrc
set incsearch
set ignorecase
set smartcase
set wildmenu
set wildstyle=popup
set sortnumbers
nnoremap t tj
nnoremap x :shell<cr>
@msr1k
msr1k / anaconda.bat
Created December 25, 2017 04:48
batch file which invoke anaconda prompt
%windir%\system32\cmd.exe "/K" C:\Users\%USERNAME%\AppData\Local\Continuum\Anaconda3\Scripts\activate.bat C:\Users\%USERNAME%\AppData\Local\Continuum\Anaconda3
@msr1k
msr1k / anapy.bat
Last active February 1, 2018 04:23
Example batch file which invokes anaconda prompt and execute python script (Windows)
@FOR /F "delims=" %%i IN ('@call "C:\Users\%USERNAME%\AppData\Local\Continuum\Anaconda3\Scripts\conda.exe" ..activate "cmd.exe" %1') DO @SET "NEW_PATH=%%i"
@SET PATH=%NEW_PATH%;%PATH%
python %2
@msr1k
msr1k / mm2txt.rb
Created February 8, 2018 04:17
Convert FreeMind's *.mm file into text
require 'rexml/document'
class Mm2Txt
def self.convert(filename, out=STDOUT)
contents = File.open(filename, 'r', &:read)
doc = REXML::Document.new(contents)
Impl.traverse(0, doc.elements['//map/node'], out)
end
@msr1k
msr1k / rm_qt_debug_dlls.rb
Created May 10, 2018 10:06
ruby script which deletes all Qt debug version DLLs recursively
dlls = Dir['**/*.dll']
dlls.each do |dll|
debug_version_dll_name = dll.sub(/^(.*)\.dll$/, '\1d.dll')
if dlls.include?(debug_version_dll_name)
puts "Delete #{debug_version_dll_name}"
File.delete(debug_version_dll_name)
end
end
@msr1k
msr1k / a.rb
Last active August 2, 2018 01:31
opal test
class A
native_class if RUBY_ENGINE == 'opal'
def a
puts 'a'
end
native_alias :a, :a if RUBY_ENGIN == 'opal'
end