Skip to content

Instantly share code, notes, and snippets.

@phistep
phistep / init.vim
Last active March 22, 2023 20:33
firenvim config
" """
" firenvim (browser textareas)
"
" unfortunately `if exists('g:started_by_firenvim')` doesn't work with
" laststatus and tabline. So we need to use the OnUIEnter function to set
" specific options
function! s:IsFirenvimActive(event) abort
if !exists('*nvim_get_chan_info')
return 0
@phistep
phistep / read_dir.py
Last active August 14, 2020 10:52
Python glob example
#!/bin/python3
# run as
# python3 read_dir.py test_dir
import os
import sys
import glob
import numpy as np
@phistep
phistep / batch.py
Created July 23, 2020 11:42
Minimal Paramter Varying Batch Job Submission System
#!/usr/bin/python3
import argparse
import itertools as it
import os
import subprocess as sp
import multiprocessing as mp
parser = argparse.ArgumentParser(description="Run script for all combinations of arguments in parallel")
parser.add_argument('config', type=str, help="config file")
@phistep
phistep / index.php
Last active May 5, 2020 20:31
Cook-Off Submission Site
<html>
<head>
<title>Creative Cook-Off</title>
<style>
header {
text-align: center;
}
main {
margin: 0 auto;
width: 800px;
@phistep
phistep / Makefile
Created September 7, 2015 20:56
premake Problems
# GNU Make workspace makefile autogenerated by Premake
.NOTPARALLEL:
ifndef config
config=debug
endif
ifndef verbose
SILENT = @
@phistep
phistep / .vimrc
Last active December 14, 2015 07:29
My Vim config
" """""
" .vimrc
" v1.4.1
"
set nocompatible " be iMproved
" """
" Vundle
@phistep
phistep / omilia_v1.0.0_to_v1.1.0_db_converter.rb
Last active December 14, 2015 02:59
Small script to migrate the database of [omilia](https://github.com/Ps0ke/omilia) from v1.0.0 to v1.1.0. It can easily be run directly from gist: $ ruby -e "$(curl https://gist.github.com/Ps0ke/5018106/raw/)"
require 'net/http'
require 'cgi'
require 'json'
require 'data_mapper'
require './models/dataset'
require './models/user'
def set foo, bar
true
end
require './config'
#!/usr/bin/env bash
# Read more about this here: http://blog.ps0ke.de/2012/08/15/20/27/mdbl0g-benchmark
if [[ $# -ne 2 ]]; then
echo "Usage: $0 path/to/target/dir <Number of files to create>"
exit
fi
for i in `seq 1 $2+1`; do
year=`shuf -i 1900-2012 -n 1`
month=`shuf -i 10-12 -n 1`
<?php
$outputdir = './mdbl0g-wp-import-posts';
$db = @new MySQLi('localhost', 'username', 'password', 'database');
/* *************************** */
error_reporting(0);
if (mysqli_connect_errno())
die('MySQL error occured:'.mysqli_connect_error());