Skip to content

Instantly share code, notes, and snippets.

View bunnylab's full-sized avatar
💭
ouiyjmqiqsquiqhsyfxuhucqybcujxyijunjvehfhypu

Graham T bunnylab

💭
ouiyjmqiqsquiqhsyfxuhucqybcujxyijunjvehfhypu
View GitHub Profile
//imports our data from a tab delimited or csv file
//put each time step on a different row
ball_data = importdata('insertfilepath');
//keeps a constant plot for us to write an animation on
hold on
//itterate through all the time steps writing a frame for each one
for i=1:length(ball_data)
%imports our data from a tab delimited or csv file
%put each time step on a different row
ball_data = importdata('insertfilepath');
%keeps a constant plot for us to write an animation on
hold on
%itterate through all the time steps writing a frame for each one
for i=1:length(ball_data)
@bunnylab
bunnylab / dscore_parser.py
Last active August 29, 2015 14:11
dScore Script for Implicit association test output
#!/usr/bin/env python
import numpy as np
import os
print "Starting DScore Script"
#mapped conversion function, changes string block names to integers for numpy array
def block2num(blockString):
return int(blockString[5:])
def substitute(string1, lookuptable):
tmp = ''
for char in string1:
tmp += lookuptable[char]
return tmp
table = {'a':'b','b':'c','c':'d'}
test = 'abc'
#include <iostream>
#include <string.h>
#include <thread>
#include <unordered_map>
const int THREAD_MAX = 8;
std::unordered_map<char,char> leet = {{'a','@'},{'e','3'},{'l','1'},{'o','0'},{'s','$'}};
void leetify(char* input, int start, int step){
std::unordered_map<char,char>::iterator it;
#include <stdio.h>
#define INPUT_LEN 200
// Get the three numbers from a list of INPUT_LEN that sum to 2020
// and return their product
int main(){
FILE *fp;
int nums[INPUT_LEN];
fp = fopen("input.txt", "r");
const char b64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
char* binaryToBase64(char* binary, int n){
size_t temp;
char* output_buffer = (char*)malloc( (n/3*4) * sizeof(char));
for(int i=0, j=0; i<n; i+=3, j+=4){
// smush 3 bytes into our int
temp = binary[i];
temp = temp << 8 | binary[i+1];
@bunnylab
bunnylab / tracking.py
Last active February 26, 2022 00:34
script for simple web analytics
#!/usr/bin/env/python
'''
NGINX TRACKING PIXEL VIEW COUNT
This is a pretty simple python script to parse nginx access logs for hits on a
set of image files corresponding to some sites we want to keep track of views on.
Writes out updated view counts to a json file at /var/www/test/test.json
'''
import re, json
from datetime import datetime, timedelta