Skip to content

Instantly share code, notes, and snippets.

View crazyguitar's full-sized avatar
🎯
Focusing

CHANG-NING TSAI crazyguitar

🎯
Focusing
View GitHub Profile
@crazyguitar
crazyguitar / LICENSE.txt
Created April 10, 2022 05:02 — forked from bsingr/LICENSE.txt
http json echo server written in python3
Copyright (c) 2016 Jens Bissinger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@crazyguitar
crazyguitar / 01-steps.md
Created April 5, 2022 09:07 — forked from arun-gupta/01-steps.md
Kubernetes and Fargate

Create Amazon EKS Cluster

eksctl create cluster --name fargate --region us-east-1 --version 1.14 --fargate
[ℹ]  eksctl version 0.11.1
[ℹ]  using region us-east-1
[ℹ]  setting availability zones to [us-east-1c us-east-1d]
[ℹ]  subnets for us-east-1c - public:192.168.0.0/19 private:192.168.64.0/19
[ℹ]  subnets for us-east-1d - public:192.168.32.0/19 private:192.168.96.0/19
[ℹ]  using Kubernetes version 1.14
@crazyguitar
crazyguitar / kmp.cpp
Created March 14, 2022 08:31 — forked from YDrall/kmp.cpp
c++ implementation of kmp string matching algorithm.
#include<iostream>
#include<string>
using namespace std;
int *pre_kmp(string pattern)
{
int size = pattern.size();
int *pie=new int [size];
pie[0] = 0;
@crazyguitar
crazyguitar / call_method_with_reflection.go
Created March 2, 2022 08:21 — forked from tkrajina/call_method_with_reflection.go
Golang, call method (and fill arguments) with reflection
package main
import (
"fmt"
"reflect"
)
type Aaa struct {
a string
}
@crazyguitar
crazyguitar / sha256.cpp
Created February 26, 2022 07:08 — forked from arrieta/sha256.cpp
Calculate and display the SHA-256 hash of a list of files using OpenSSL from C++
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*-
/// @file sha256.cpp
/// @brief Calculate and display the SHA-256 hash of a list of files.
/// @author J. Arrieta <[email protected]>
/// @date October 10, 2017
/// @copyright (c) 2017 Nabla Zero Labs
/// @license MIT License
///
/// Compiled in macOS High Sierra 10.13 (previous installation of OpenSSL 1.1.0).
@crazyguitar
crazyguitar / bitstream.js
Created February 20, 2022 05:28 — forked from bellbind/bitstream.js
[JavaScript] QR code generator from scratch
// big endian bit stream
export class BitWriter {
constructor(buf = [], byte = 0, pos = 7) {
this.byte = byte;
this.pos = pos;
this.buf = Array.from(buf);
}
writeBit(b) {
this.byte |= (b & 1) << this.pos;
this.pos--;
@crazyguitar
crazyguitar / Convolution.hpp
Created November 2, 2021 07:04 — forked from inspirit/Convolution.hpp
Separable Convolution and Gaussian Blur
#pragma once
#ifndef CONVOLUTION_H_INCLUDED
#define CONVOLUTION_H_INCLUDED
/**
* Separable Convolution routines with SSE and NEON intrinsics
*
* this implementation is based on OpenCV Filter Class
* with template optimizations and SIMD intrinsic
*
@crazyguitar
crazyguitar / main.cpp
Created October 25, 2021 01:45 — forked from micjabbour/main.cpp
C++ time profiling example
//from Howard Hinnant's answer https://stackoverflow.com/a/18303787
#include <random>
#include <chrono>
#include <iostream>
std::random_device eng; //can be used to generate random input for test cases
std::uniform_int_distribution<std::size_t> random(500, 1000);
//a function template that executes a given function object and returns
@crazyguitar
crazyguitar / jwtRS256.sh
Created October 24, 2021 19:33 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@crazyguitar
crazyguitar / Clang-format Comparison.md
Last active October 24, 2021 18:00 — forked from andrewseidl/ Clang-format Comparison.md
Clang-format style comparison

This is a comparison of the different formatting styles including with clang-format.

Generated via:

styles=( LLVM Google Chromium Mozilla WebKit )
for style in $styles
do
  clang-format -style=$style ChLcpIterativeAPGD.h > ChLcpIterativeAPGD.$style.h

done