This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "compiling MIDL..." :: Make sure tools are in PATH (eg Developer Command Prompt for VS 2017) | |
midl myfilectl.idl /tlb myfilectl.tlb | |
echo "done." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Refs: | |
% 1. https://en.wikipedia.org/wiki/Stefan%E2%80%93Boltzmann_law#cite_note-Solar_constant_at_ground_level-9 | |
% 2. https://en.wikipedia.org/wiki/Sunspot | |
% Kelvin | |
K = 273.15; | |
% sun earch distance | |
r = 149600000; % meters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[y, Fs] = audioread('01_DJ.wav'); | |
h = [1, zeros(1,0.4*Fs), 0.5, zeros(1,0.4*Fs), 0.2]; | |
plot(h) | |
out = conv((y(:,1)+y(:,2))/2,h); | |
sound(out,Fs); | |
plot(out); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Computing angles of complex eigenvalues for some random matrices | |
for i in range(60): | |
M = np.matrix(np.random.rand(10,10)) | |
w, v = LA.eig(M) | |
args = np.angle(w, deg=True) | |
print("\t\t".join(map(lambda x:str(round(x, 2)), args))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iterator> | |
#include <fstream> | |
#include <algorithm> | |
#include <cstdio> | |
#include <vector> | |
#include <cmath> | |
#include <limits> | |
#include <iomanip> | |
#include <string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ fun.cc -masm=intel | |
float fpzero = 0; | |
unsigned long pfpzero = (unsigned long)&fpzero; | |
__asm__ volatile("xorps xmm1, xmm1"); | |
__asm__ volatile("fldpi"); // load PI | |
__asm__ volatile("fchs"); // change sign | |
__asm__ volatile("fst dword ptr [%0]":"=&r"(pfpzero)); | |
// this should be -3.14159... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdlib> | |
#include <iostream> | |
#include <cstdio> | |
#include <cmath> | |
#include <thread> | |
#include <string> | |
#include <chrono> | |
#include <GL/glut.h> | |
#include <GL/glu.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/types.h> | |
#include <arpa/inet.h> | |
#include <netinet/in.h> | |
#include <sys/socket.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use locale; | |
use utf8; | |
#use open qw(:std :utf8); | |
#use feature 'unicode_strings'; | |
use Cassandra::Lite; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sendgrid | |
import os | |
from sendgrid.helpers.mail import * | |
sg = sendgrid.SendGridAPIClient(apikey="...") | |
from_email = Email("[email protected]") | |
to_email = Email("[email protected]") | |
subject = "Please activate your ABC account" | |
content = Content("text/html", "<h1>Welcome to ABC</h1>Please click this <a href=\"http://www.abc.com/activate/32132112121\">link</a> to activate your account!") | |
mail = Mail(from_email, subject, to_email, content) |
NewerOlder