Skip to content

Instantly share code, notes, and snippets.

@Ps0ke
Ps0ke / read_dir.py
Last active Aug 14, 2020
Python glob example
View read_dir.py
#!/bin/python3
# run as
# python3 read_dir.py test_dir
import os
import sys
import glob
import numpy as np
@Ps0ke
Ps0ke / batch.py
Created Jul 23, 2020
Minimal Paramter Varying Batch Job Submission System
View batch.py
#!/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")
@Ps0ke
Ps0ke / index.php
Last active May 5, 2020
Cook-Off Submission Site
View index.php
<html>
<head>
<title>Creative Cook-Off</title>
<style>
header {
text-align: center;
}
main {
margin: 0 auto;
width: 800px;
@Ps0ke
Ps0ke / Makefile
Created Sep 7, 2015
premake Problems
View Makefile
# GNU Make workspace makefile autogenerated by Premake
.NOTPARALLEL:
ifndef config
config=debug
endif
ifndef verbose
SILENT = @
@Ps0ke
Ps0ke / .vimrc
Last active Dec 14, 2015
My Vim config
View .vimrc
" """""
" .vimrc
" v1.4.1
"
set nocompatible " be iMproved
" """
" Vundle
@Ps0ke
Ps0ke / omilia_v1.0.0_to_v1.1.0_db_converter.rb
Last active Dec 14, 2015
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/)"
View omilia_v1.0.0_to_v1.1.0_db_converter.rb
require 'net/http'
require 'cgi'
require 'json'
require 'data_mapper'
require './models/dataset'
require './models/user'
def set foo, bar
true
end
require './config'
View benchmark.sh
#!/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`
View mdbl0g-wordpress-importer.php
<?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());
You can’t perform that action at this time.