Skip to content

Instantly share code, notes, and snippets.

@Nican
Nican / crdb.cs
Last active March 1, 2022 18:08
Test `FOR UPDATE` for CRDB
using Dapper;
using Npgsql;
using System.Diagnostics;
int quantity = 100;
var connStringBuilder = new NpgsqlConnectionStringBuilder();
connStringBuilder.Host = "55.55.55.20";
connStringBuilder.Port = 26257;
connStringBuilder.Username = "root";
@Nican
Nican / keybase.md
Created March 27, 2015 06:34
keybase.md

Keybase proof

I hereby claim:

  • I am nican on github.
  • I am nican (https://keybase.io/nican) on keybase.
  • I have a public key whose fingerprint is 885A 5D07 2EFE F7A9 4E76 5561 B667 450A FD7F 2446

To claim this, I am signing this object:

### My publicly-auditable identity:
https://keybase.io/nican
### From the command line:
Consider the [keybase command line program](https://keybase.io/docs/command_line).
```bash
# look me up
@Nican
Nican / qtogre3d.cpp
Created May 27, 2014 20:28
Qt inside of Ogre
//--------------- Testing Ogre3d ----------------
Ogre::TexturePtr txtr;
QGraphicsView* test;
void updateOgreTexture();
txtr = Ogre::TextureManager::getSingleton().createManual(
//! Rotation Limit structure for generic joints
class btRotationalLimitMotor
{
public:
//! limit_parameters
//!@{
btScalar m_loLimit;//!< joint limit
btScalar m_hiLimit;//!< joint limit
btScalar m_targetVelocity;//!< target motor velocity
btScalar m_maxMotorForce;//!< max force on motor
@Nican
Nican / Working example for python callback
Last active December 1, 2023 05:42
Python callback
############## main.c ##############
#include <stdint.h>
#include <stdio.h>
struct mes_t
{
uint32_t field1;
uint32_t field2;
void* data;
};
@Nican
Nican / evenfib.clj
Created January 10, 2012 22:37
Find even fibonacci numbers
;;Returns the next even fibbonaci number
;; F[n] = 3*F[n-1] + 4*F[n-2] + 5F[n-3] + ... + (x+2)*F[n-x]
(defn evenfib-next [seq]
(letfn getsum [seq count]
(cond
(empty? seq) 0
:else (+
(* count (first seq))
(getsum (rest seq) (+ count 1)))))