Skip to content

Instantly share code, notes, and snippets.

Jonathan Decker Lokno

Block or report user

Report or block Lokno

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Lokno
Lokno / cksum_function.c
Last active Jul 10, 2019
Posix checksum of all return values given every possible input to a single-parameter single-precision function
View cksum_function.c
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef union
{
unsigned int ui;
unsigned char c[4];
float f;
@Lokno
Lokno / cuda_kernel_query.py
Last active Apr 3, 2019
Script that compiles a CUDA application to report the attributes of a kernel
View cuda_kernel_query.py
# Compiles a CUDA application to report the attributes of a kernel
#
# usage: cuda_kernel_query.py <file> <entry name> [<define list>]
#
# file - name of the CUDA source file contain the kernel of interest
# entry name - name of the kernel to examine
# define list - comma delimited list of proprocessor defines for compilation
#
# If BLOCK_SIZE is defined in the file, this value is used in the occupancy
# calculation, otherwise the blockSize returned by
@Lokno
Lokno / run_handler.py
Created Mar 25, 2019
Python 3 script for running an application multiple times
View run_handler.py
# Script for running an application multiple times
#
# usage run_handler.py "<app + args>" <times> [output.csv]
#
# This script runs the a process multiple times and reports the
# average running time. Optionally, a file name can be provided,
# and the script will append the execution of each completed time
# into a file of that name.
#
# The script further estimates its total running time after the
@Lokno
Lokno / twitch_slack_bot.py
Created Feb 22, 2019
Simple slack bot that polls twitch and announces when users are active
View twitch_slack_bot.py
import os,time
from slackclient import SlackClient
from twitch import TwitchClient
client = TwitchClient(client_id=os.environ.get('TWITCH_TOKEN'))
# Dictionary of twitch accounts
twitchAccounts = {'NAME' : {'username' : 'TWITCH_USERNAME'}}
wait_time = 60
@Lokno
Lokno / idle_nj.py
Last active Aug 10, 2019
Joins an IRC channel and parses the chat messages for # percentages. Nick and Janel Variant
View idle_nj.py
# Author : Jonathan Decker "Lokno"
# Description: Joins an IRC channel and parses the chat messages for
# percentages. It writes the average percentage from each unique
# user to a file. Idle contributions are removed after a number of
# seconds, as defined by the variable lifeTime declared on line 19
#
# Nick and Janel Variant - type dd%n for nick and dd%j for Janel
# dd% without a letter will default to nick.
#
# Reference:
@Lokno
Lokno / ChainNumber.h
Last active Dec 30, 2018
C++ Class for representing positive integer with linked lists
View ChainNumber.h
#pragma once
// ChainNumber
// Author: Lokno Decker
//
// C++ Class for representing positive integer with linked lists
//
// Written as an exercise in absurty, but potentially useful
// for memory obfuscation for calculations of small integers
//
@Lokno
Lokno / pairs.py
Created Dec 1, 2018
Short python 3 script for producing a set of exchange pairs from a list of names
View pairs.py
from random import shuffle
names = []
with open('names.txt','r') as f:
names = f.readlines()
n = len(names)
if n > 1:
shuffle(names)
@Lokno
Lokno / generate_hanoi_problem.py
Created Oct 31, 2018
Python script to generate a PDDL format problem for the hanoi problem. For use with hanoi-domain.pddl.
View generate_hanoi_problem.py
num_disks = 15
num_pegs = 3
disks = ['disk%d' % (i+1) for i in range(num_disks)]
pegs = ['peg%d' % (i+1) for i in range(num_pegs)]
filename = 'hanoi-problem.pddl'
init = ['(clear disk1)']
goals = ['(clear disk1)']
@Lokno
Lokno / doormon.py
Last active Aug 18, 2018
A discord bot that reports changes to a pin on the RaspberryPi GPIO (used for detecting door knocks via a SW-420 Vibration Switch). Python 3.7.0
View doormon.py
import discord
import asyncio
import RPi.GPIO as GPIO
import traceback
from discord.ext import commands
TOKEN = 'BOT_TOKEN_HERE'
description = '''A bot that reports changes to a pin on the GPIO'''
@Lokno
Lokno / screen_aligned_triangle.fx
Last active Aug 2, 2018
Renders a single screen-aligned triangle that fills the screen without a vertex buffer
View screen_aligned_triangle.fx
// Renders a single screen-aligned triangle that fills the screen without a vertex buffer
// Creates texture coordinates with (0,0) in the top left and (1,1) in the bottom right
//
// DX11 API calls:
// m_pD3D11Device->IASetInputLayout(NULL);
// m_pD3D11Device->IASetPrimitiveTopology( D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
// m_pD3D11Device->Draw(3, 0);
struct VSOut
{
You can’t perform that action at this time.