Skip to content

Instantly share code, notes, and snippets.

@Centrinia
Centrinia / Ajax Import
Created July 29, 2014 05:10
Blog Reply
'use strict';
$(document).ready(function() {
var openedReplyUrl = null;
var openedReplyComment = null;
$('.comment').each(function (index, commentElement) {
$(commentElement).find('.reply').click(function (e) {
var replyUrl = $(commentElement).attr('reply-url');
if(openedReplyUrl == replyUrl) {
return;
#!/usr/bin/python3
#import png
import itertools
import time
import numpy as np
import math
import random
import os
#include <stdlib.h>
#include <stdio.h>
typedef int bool;
#define true 1
#define false 0
#define SWAP(a,b) { (a) ^= (b); (b) ^= (a); (a) ^= (b); }
@Centrinia
Centrinia / sudoku.py
Created October 9, 2015 14:10
Sudoku
#!/usr/bin/python3
import sys
import itertools
import time
N = 9
S = 3
def process(f):
@Centrinia
Centrinia / bitset.h
Created November 3, 2015 01:03
Sieve of Eratosthenes With Wheel
/* bitset.h */
template <typename T>
inline constexpr T ceildiv(const T a, const T b) {
return (a + b - 1) / b;
}
/* Rotate the bits of x to the right by I bits. */
template <typename T>
inline T rotate_right(const T & x, const int & I)
// Gaussian filter of image
__kernel void gaussian_filter(__read_only image2d_t srcImg,
__write_only image2d_t dstImg,
sampler_t sampler,
int width, int height)
{
// Gaussian Kernel is:
// 1 2 1
@Centrinia
Centrinia / log
Last active January 15, 2016 16:49
exc@lambda ~/src/examples/opencl/prefix_sum $ optirun python3 prefix_sum.py
[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30 31]
(16,) None
<pyopencl.cffi_cl.CommandQueue object at 0x7f378fefcac8> (16,) None <pyopencl.cffi_cl.Buffer object at 0x7f3787cce470> <pyopencl.cffi_cl.Buffer object at 0x7f3787cd8d68> 0 1
Adding ap[54668944] and ap[109337888] (start, stride: 54668944, 54668944), (size: 16,0)
Adding ap[164006832] and ap[218675776] (start, stride: 54668944, 54668944), (size: 16,0)
Adding ap[273344720] and ap[328013664] (start, stride: 54668944, 54668944), (size: 16,0)
Adding ap[382682608] and ap[437351552] (start, stride: 54668944, 54668944), (size: 16,0)
Adding ap[492020496] and ap[546689440] (start, stride: 54668944, 54668944), (size: 16,0)

Keybase proof

I hereby claim:

  • I am centrinia on github.
  • I am centrinia (https://keybase.io/centrinia) on keybase.
  • I have a public key whose fingerprint is 323C F1FE 64B4 F3CF C2E3 041D 7B34 CAF1 BA17 EE35

To claim this, I am signing this object:

#!/usr/bin/python3
#import png
import itertools
import time
import numpy as np
import math
import random
import os
/* bf.cc */
#include <iostream>
#include <fstream>
#include <vector>
typedef char heap_type;
int main(int argc, char** argv) {
std::ifstream in;