Skip to content

Instantly share code, notes, and snippets.

View msawangwan's full-sized avatar
😎

misha sawangwan msawangwan

😎
View GitHub Profile
@yewton
yewton / gist:2723321
Created May 18, 2012 05:23
LCG, xor shift
#include <iostream>
using namespace std;
class LCG {
unsigned long s;
static const unsigned long M = 1103515245UL;
static const unsigned long A = 12345UL;
static const unsigned long B = 2147483647UL;
public:
@xgalaxy
xgalaxy / gist:6743756
Last active April 24, 2019 08:40
Example of working with anonymous types in Unity3d
using System;
using System.Collections;
using UnityEngine;
public class Testing : MonoBehaviour
{
void Start()
{
// In C#, this is an 'Anonymous Type'
// A new System.Type is generated for it at compile type
@michaelbartnett
michaelbartnett / .gitattributes
Created November 10, 2012 21:24
Git meta files for a Unity Project
*.meta -diff
*.asset -diff
*.unity -diff
@kylemcdonald
kylemcdonald / smootheststep.txt
Last active December 19, 2019 23:22
Derivation of 7th-order smoothstep function with zeros in third derivative.
7th-order spline and first three derivatives
f(t) = a_7 t^7+a_6 t^6+a_5 t^5+a_4 t^4+a_3 t^3+a_2 t^2+a_1 t+a_0
f'(t) = 7 a_7 t^6+6 a_6 t^5+5 a_5 t^4+4 a_4 t^3+3 a_3 t^2+2 a_2 t+a_1
f''(t) = 42 a_7 t^5+30 a_6 t^4+20 a_5 t^3+12 a_4 t^2+6 a_3 t+2 a_2
f'''(t) = 210 a_7 t^4+120 a_6 t^3+60 a_5 t^2+24 a_4 t+6 a_3
Constraints
f(0) = 0 = a_0
f(1) = 1 = a_7 + a_6 + a_5 + a_4 + a_3 + a_2 + a_1 + a_0
f'(0) = 0 = a_1
#!/usr/bin/env python
# easyIMAP2Notes (C)2015 by Jan-Piet Mens
# Connect to an IMAP mailbox, read messages, and convert them into
# a format suitable for iOS/OSX Notes, then store them in Notes/
#
# This uses two connections (consider that a feature b/c you can
# slurp from one IMAP account into another). The real reason is I
# couldn't be bothered to implement message decoding/attachment
# extraction with imaplib, so I chose easyimap (pip install easyimap)
# to do that.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# addnote.py by JP Mens (September 2015), inspired by Martin Schmitt
# Usage: addnote subject "body (may be empty") [image ...]
# Adds a Notes.app (OSX and iOS) compatible message to the "Notes"
# IMAP folder. The IMAP store is configured from a file called
# `creds':
#
# [imap]
# hostname =
@vbatts
vbatts / .gitignore
Last active May 13, 2020 00:17
renegotiation example
.client
.server
Dockerfile
@reterVision
reterVision / insert_pg.go
Created July 5, 2014 08:18
A trivial program that uses goroutine to insert records into Postgres.
/*
Original idea from
http://www.acloudtree.com/how-to-shove-data-into-postgres-using-goroutinesgophers-and-golang/
*/
package main
import (
"log"
"time"
"os"
package main
import (
"bufio"
"fmt"
"log"
"os"
"strings"
)
@dcrystalj
dcrystalj / startup.bat
Created December 12, 2013 11:12
windows conEmu startup aliases
doskey subl="C:\Program Files\Sublime Text 2\sublime_text.exe" $*
doskey ls=ls $1 --color
doskey ll=ls -la --color
doskey sbl = sublime $*
doskey sshs = ssh tom@188.230.237.133
doskey oocd = openocd-x64-0.6.1 -f .\stm32f4discovery.cfg
doskey oocd7 = openocd-x64-0.7.0 -f .\stm32f4discovery.cfg
doskey sshkey = type C:\Users\dcrystalj\.ssh\id_rsa.pub | clip & echo "ssh key in clipboard"
:: Git