Skip to content

Instantly share code, notes, and snippets.

View maxint's full-sized avatar

Naiyang Lin maxint

View GitHub Profile
@maxint
maxint / im_action_example.cpp
Last active July 6, 2020 11:53
ImAction: shortcut management for Dear ImGui
#include "imgui_action_example.h"
void ImActionExamples()
{
static bool copied = false;
ImActionManager::Instance().RemoveAll();
ImAction* action_copy = ImActionManager::Instance().Create("Copy", ImCtrl + 'C');
ImAction* action_paste = ImActionManager::Instance().Create("Paste", ImCtrl + 'V');
action_paste->setEnabled(copied);
ImActionManager::Instance().ResetAll();
@maxint
maxint / outlook.py
Created January 27, 2015 01:08
Send email through Outlook
import win32com.client
def send_mail_via_com(text, subject, recipient, profilename="Outlook2003"):
s = win32com.client.Dispatch("Mapi.Session")
o = win32com.client.Dispatch("Outlook.Application")
s.Logon(profilename)
Msg = o.CreateItem(0)
Msg.To = recipient
@maxint
maxint / fast_exp.cpp
Created July 4, 2014 02:36
Fast Exp calculation: possible to improve accuracy without losing too much performance?
// x ~ (-1, 0)
// It's slower than system std::exp() in android NDK.
static double fast_exp(double x)
{
static double ExpAdjustment[] = {
1.04070848547586,1.04009060846346,1.03945435963673,1.03884515889925,1.03824021815052,1.03763944558270,1.03704295680744,1.03645059259355,1.03586240137854,1.03527831512575,1.03469840149188,1.03412251023128,1.03355074779371,1.03298296727100,1.03241929516751,1.03183892933538,1.03128335809127,1.03073176709173,1.03018410274259,1.02964039971006,1.02910058394928,1.02856467003324,1.02803260508207,1.02750442366190,1.02698005301085,1.02645952638791,1.02594275638492,1.02542979170181,1.02490179082401,1.02439640847484,1.02389482719960,1.02339687921152,1.02290267688865,1.02241207333728,1.02192519791699,1.02144188682589,1.02096225009002,1.02048614419477,1.02001369563484,1.01954476213512,1.01907941470823,1.01860052392423,1.01814228962482,1.01768762156337,1.01723639117398,1.01678864295365,1.01634430115608,1.01590345952391,1.01546599234047,1.01503194376712,1.01460123930548,1.01417
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny