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
function IHexChecksum() | |
let l:data = getline(".") | |
let l:dlen = strlen(data) | |
if (empty(matchstr(l:data, "^:\\(\\x\\x\\)\\{5,}$"))) | |
echoerr("Input is not a valid Intel HEX line!") | |
return | |
endif | |
let l:byte = 0 |
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
: between (x a b -- flag ) | |
-rot over | |
<= | |
-rot >= | |
and | |
; |
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
\ LONG VERSION | |
: sign_ ( x -- sign(x) | |
?dup if | |
0> if 1 else -1 then | |
else 0 then ; | |
\ SHORT VERSION | |
: sig dup if 0> if 1 else -1 then then ; | |
\ more optimized | |
: sig dup 0< over 0 > negate + ; |
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
%\title{LaTeX Table spacing example} | |
% Example by John Hammersley | |
\documentclass{article} | |
\usepackage[usenames,dvipsnames]{xcolor} | |
\begin{document} | |
\section*{Table with default spacings} | |
% A table with the default row and column spacings |
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
\documentclass[border=2pt]{standalone} | |
\usepackage{tikz} | |
\begin{document} | |
\begin{tikzpicture} | |
\newcounter{shifty} \setcounter{shifty}{0} | |
\foreach \n/\w in {A/1,B/2,A/1,A/1,B/2}{ | |
\node[yshift=\theshifty cm,draw,minimum height=1cm,minimum width=\w cm,anchor=west,outer sep=0pt]{\n}; | |
\draw[yshift=\theshifty cm,thick] (0,.6cm)--(0,-.6cm); | |
\addtocounter{shifty}{\w} | |
} |
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 random | |
x = [random.random() for i in range(128)] | |
N = 5 | |
#x = range(22) | |
y = x[-N:] + x[:-N] | |
y2 = [i + 0.9*random.random() for i in y] | |
mx, my = sum(x)/len(x), sum(y)/len(y) | |
my2 = sum(y2)/len(y2) | |
mx, my, my2 = 0,0,0 |
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
class CProgress: | |
"""Uses the Bresenham algorithm for line segments in the first octant.""" | |
def __init__(self,title='', mx=100): | |
self.deltax = mx | |
self.deltay = 40 | |
self.error, self.progress_y = 0, 0 | |
sys.stdout.write(title + ": [" + "-"*40 + "]" + chr(8)*41) | |
sys.stdout.flush() | |
def progress(self): |
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
\ print fixed point, two digs after dec point | |
: f.2 ( df -- ) | |
0,005 d+ \ rounding | |
0 <# #s 2drop \ whole part | |
[char] . hold< \ decimal separator | |
f# f# \ frac part | |
0 #> \ finish | |
type space \ print | |
; |
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
#ifdef __GNUC__ | |
#define INLINE inline __attribute__((always_inline)) | |
#else | |
#define INLINE | |
#endif | |
{ |
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 <string.h> | |
char X[] = | |
" ETIANMSURWDKGOHVF:L:PJBXCYZQ::54:3:::2&:+::::16=/:::(:7:::8:90" | |
"::::::::::::?_::::\"::.::::@:::'::-::::::::;!:):::::,:::::"; | |
int j,w,h,f,u,d,g,e,n,i,l,a,r,p,c,m,o,t,s,Q=32,T[32],W[32],I=13000; | |
int main(int v, char** b) { |
OlderNewer