Skip to content

Instantly share code, notes, and snippets.

@VermeilChan
VermeilChan / compile-aseprite-win.md
Last active May 21, 2024 23:37
Compile Aseprite from source code for Windows 11/10 x64
@kingluo
kingluo / a.md
Last active August 18, 2023 11:32
How to trace nginx blocking issue via systemtap?

Test

# run openresty
/usr/local/openresty/nginx/sbin/nginx -p $PWD -c nginx.conf -g "daemon off;"

# run systemtap script
./samples/blocking-bt.sxx -D STP_NO_OVERLOAD --arg time=60 --skip-badvars -x 144081

# trigger the workload
@prism-lab
prism-lab / clion-eval-reset-windows.md
Created July 2, 2020 04:25
How to reset Clion evaluation trial on Windows but keep the IDE settings intact.

Env: Windows 10 Clion 2020.1.2 installed via jetbrains toolbox(other install methods should be ok too)

Solution:

  1. Delete the Registry key: Computer\HKEY_CURRENT_USER\SOFTWARE\JavaSoft\Prefs\jetbrains\clion
  2. Delete C:\Users\$your-username\AppData\Roaming\JetBrains\CLion2020.1\eval folder.
  3. Delete C:\Users\$your-username\AppData\Roaming\JetBrains\CLion2020.1\options\other.xml or open up this file and try to get rid of eval references.
  4. See you in a month :)
@fnky
fnky / ANSI.md
Last active May 23, 2024 17:34
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@Leandros
Leandros / random.h
Created July 2, 2018 05:22
C++ Pseudo Random Number Generators
/* Copyright (c) 2018 Arvid Gerstmann. */
/* This code is licensed under MIT license. */
#ifndef AG_RANDOM_H
#define AG_RANDOM_H
class splitmix
{
public:
using result_type = uint32_t;
static constexpr result_type (min)() { return 0; }
@alexshtf
alexshtf / constexpr_sqrt.cpp
Last active June 7, 2023 11:19
Constexpr version of c++ square root (for doubles)
#include <limits>
namespace Detail
{
double constexpr sqrtNewtonRaphson(double x, double curr, double prev)
{
return curr == prev
? curr
: sqrtNewtonRaphson(x, 0.5 * (curr + x / curr), curr);
}
@vittorioromeo
vittorioromeo / hello_triangle.cpp
Created October 10, 2015 11:07
SDL2 + OpenGL ES 2.0 - "Hello triangle" example that works both on X11 and Emscripten
#include <exception>
#include <functional>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
@burtonsamograd
burtonsamograd / save-lisp-tree-shake-and-die.lisp
Last active February 11, 2024 20:33
A quick and dirty tree shaker for SBCL, giving about a 40% reduction in dump size.
;; -*- mode: lisp -*-
;;
;; A quick and dirty tree shaker for SBCL. Basically, it destroys the
;; package system and does a gc before saving the lisp image. Gives
;; about a 40% reduction in image size on a basic hello world test.
;; Would like to hear how it works on larger projects.
;;
;; Original idea from: https://groups.google.com/d/msg/comp.lang.lisp/6zpZsWFFW18/WMy4PyA9B4kJ
;;
;; Burton Samograd
@c4tachan
c4tachan / DeviceOrientationReader.js
Last active November 20, 2019 19:08
Implementation of reading the orientation of a device using JavaScript. Eventually, this will also include code to open a web socket and transmit that information to a server. This script was shamelessly stolen and modified from the source code of http://www.html5rocks.com/en/tutorials/device/orientation/deviceorientationsample.html
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
init();
var count = 0;
function init()
{