This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, ctypes, signal | |
from OpenGL import GL, GLU | |
from PyQt5 import QtCore, QtGui, QtWidgets | |
position_data = (ctypes.c_float*12)( | |
-1,-1, 1,-1, -1,1, 1,-1, 1,1, -1,1) | |
vertex_shader = (GL.GL_VERTEX_SHADER, ''' | |
#version 150 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import threading | |
import re | |
import signal | |
import os | |
import curses | |
import keyword | |
import sys | |
import time | |
import ast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <wait.h> | |
#include <assert.h> | |
#include <errno.h> | |
#include <sys/signal.h> | |
#include <sys/types.h> | |
#include <sys/ptrace.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <errno.h> | |
#include <signal.h> | |
#include <stdarg.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/ptrace.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <libtcc.h> | |
void callme(int x) { | |
printf("hello, %d\n", x); | |
} | |
void error_func(void * user, const char * msg) { | |
printf("TCC Error: %s\n", msg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
try: | |
import numpy as np | |
except ImportError: | |
print('Numpy package not found, install with') | |
print('pip install numpy') | |
exit(1) | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- edited from https://gist.github.com/t2psyto/7b5e08c4d216cfb8d79a86d676be0642 --> | |
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.9.0/brython.js"> </script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.0/p5.js"></script> | |
</head> | |
<body onload='brython()'> | |
<textarea rows=25 cols=80 name=sourcecode id=sourcecode> | |
def setup(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Automatically saves all you matplotlib plot using pickle to a sqlite database | |
such that you can open them later, interactively. | |
Put this file somewhere on your PYTHONPATH and add this to your .bashrc | |
export PYTHONPATH="/path/to/directory" | |
export MPLBACKEND="module://autosave_mpl_background" | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
import tflite_runtime.interpreter as tflite | |
# Fib function | |
@tf.function | |
def fibonacci(n): | |
a = 0 | |
b = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def to_float32(exponent, significand): | |
assert exponent.dtype == np.uint8 | |
assert significand.dtype == np.uint8 | |
negative = ((exponent & 128) >> 7) == 1 | |
exponent = (exponent & 127).astype(float)-64 | |
value = 2.0**exponent * (1.0 + significand.astype(float) / 256.0) | |
value[negative] *= -1 | |
return value |
OlderNewer