Skip to content

Instantly share code, notes, and snippets.

View Mytherin's full-sized avatar

Mark Mytherin

View GitHub Profile
@Mytherin
Mytherin / gist:7a89816ab58ca460540c
Created July 5, 2015 21:35
Count "abcabc" in string
#include <stdio.h>
int countabcabc(char *string);
char match[] = "abcabc";
int main()
{
char string[] = "abcabcabc";
import re
import os
import sys
def tibia_client_exists():
if os.system('pgrep Tibia >/dev/null 2>&1') != 0:
return False
return True
def tibia_client_id():
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace FindTabsBaseAddress {
class Program {
@Mytherin
Mytherin / llvmtest.c
Created July 5, 2016 11:50
JIT Compile a For loop using the LLVM 3.9 C API
/**
* LLVM equivalent of:
*
* void loop(double *result, double *a, double *b, size_t length) {
* for(size_t i = 0; i < length; i++) {
* result[i] = a[i] * b[i];
* }
* }
*/
@Mytherin
Mytherin / compilellvm.sh
Created July 13, 2016 22:16
Shell script for downloading and compiling CMake and LLVM from source.
export INSTALLDIR=/scratch/llvm
wget https://cmake.org/files/v3.6/cmake-3.6.0.tar.gz
tar xvf cmake-3.6.0.tar.gz
cd cmake-3.6.0
./bootstrap --prefix=$INSTALLDIR
make
make install
cd ..
@Mytherin
Mytherin / scpsync.py
Last active August 12, 2016 11:12
Automatically scp over files in a directory to the target machine whenever they are changed on the host machine.
#!/usr/bin/python
import os, time, sys, datetime
if len(sys.argv) < 3 or ':' not in sys.argv[2]:
print("Usage: scpsync [sourcepath] [dest:destpath] [src?]")
exit(1)
srcheaders = ['.h', '.c', '.py', '.r', '.hpp', '.cpp', '.mal', '.sql', '.malC','.php', '.html']
source = sys.argv[1]
['i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'you', 'your', 'yours', 'yourself', 'yourselves', 'he', 'him', 'his', 'himself', 'she', 'her', 'hers', 'herself', 'it', 'its', 'itself', 'they', 'them', 'their', 'theirs', 'themselves', 'what', 'which', 'who', 'whom', 'this', 'that', 'these', 'those', 'am', 'is', 'are', 'was', 'were', 'be', 'been', 'being', 'have', 'has', 'had', 'having', 'do', 'does', 'did', 'doing', 'a', 'an', 'the', 'and', 'but', 'if', 'or', 'because', 'as', 'until', 'while', 'of', 'at', 'by', 'for', 'with', 'about', 'against', 'between', 'into', 'through', 'during', 'before', 'after', 'above', 'below', 'to', 'from', 'up', 'down', 'in', 'out', 'on', 'off', 'over', 'under', 'again', 'further', 'then', 'once', 'here', 'there', 'when', 'where', 'why', 'how', 'all', 'any', 'both', 'each', 'few', 'more', 'most', 'other', 'some', 'such', 'no', 'nor', 'not', 'only', 'own', 'same', 'so', 'than', 'too', 'very', 's', 't', 'can', 'will', 'just', 'don', 'should', 'now', 'd', 'll', 'm', 'o',
import sqlite3
import os
import time
# showcase of a bug in the python version of sqlite3
# starting an insert with a comment will result in much slower performance and rowcount not being set properly
def test(with_comment):
os.system('rm -f test.db')
con = sqlite3.connect('test.db')
import sys, time, numpy, os
if len(sys.argv) < 2:
print("Usage: python3 benchmark-mvcc [hyper|monetdb|sqlite|duckdb]")
exit(1)
try:
os.remove('test.db')
except:
pass
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy
import sys
import subprocess
import shutil
import platform