Skip to content

Instantly share code, notes, and snippets.

Joe Marrero manvscode

Block or report user

Report or block manvscode

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View FastExp.cs
/// <summary>
/// Fast exponential approximation.
/// </summary>
/// <remarks>
/// Based on "A Fast, Compact Approximation of the Exponential Function" by Nicol N.Schraudolph (1999)
/// <code>e^x ~ a*x + b
/// a = 2 ^ (mantissa bits) / ln(2) ~ 12102203
/// b = (exponent bias) * 2^(mantissa bits) ~ 1065353216</code>
/// </remarks>
/// <param name="x">A number specifying a power.</param>
View BigDecimal.cs
using System;
using System.Numerics;
namespace Common
{
/// <summary>
/// Arbitrary precision decimal.
/// All operations are exact, except for division. Division never determines more digits than the given precision.
/// Source: https://gist.github.com/JcBernack/0b4eef59ca97ee931a2f45542b9ff06d
/// Based on https://stackoverflow.com/a/4524254
@manvscode
manvscode / default.conf
Created Apr 30, 2017 — forked from szarapka/default.conf
NGiNX Configuration for Vue-Router in HTML5 Mode
View default.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
View gdbinit
# INSTALL INSTRUCTIONS: save as ~/.gdbinit
#
# DESCRIPTION: A user-friendly gdb configuration file.
#
# REVISION : 7.3 (16/04/2010)
#
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln
#
# FEEDBACK: https://www.reverse-engineering.net
@manvscode
manvscode / subtle-bug.c
Created Apr 26, 2013
A subtle bug--what is the output?
View subtle-bug.c
#include <stdio.h>
int array[]={ 34, 2, 54, -6, -49};
#define S sizeof(array)/sizeof(array[0])
int main()
{
int d = -1;
@manvscode
manvscode / scrap-emails.rb
Created Apr 26, 2013
Scrap emails in Ruby.
View scrap-emails.rb
#!ruby
require 'net/http'
require 'uri'
def scrapEmails( urlString )
url = URI.parse( urlString )
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }
emails = res.body.scan( /[A-Za-z0-9]+[@ | (at) | (AT) ][A-Za-z0-9]+\.[A-Za-z]+/i )
return emails
@manvscode
manvscode / endian.c
Created Apr 26, 2013
Versatile functions for converting endianess.
View endian.c
typedef union two_bytes {
unsigned short s;
unsigned char bytes[ 2 ];
} two_bytes_t;
int is_big_endian( void )
{
two_bytes_t check;
check.s = 1;
View hello-world.s
# as -o hello-world.o hello-world.s ; ld -o hello-world hello-world.o
.data
hello_world_str: .ascii "Hello World!\n"
hello_world_len: .int 13
.text
.globl _start
_start:
movl $4, %eax # load sys call 4 into EAX
@manvscode
manvscode / Pointers are not the same as arrays!
Created Sep 25, 2012
I had to convince my coworker about this. Pointers are not the same as arrays!
View Pointers are not the same as arrays!
#include <stdio.h>
int main()
{
char myarray[ 256];
const char* mystring = "Hello my peeps.";
size_t array_size = sizeof(myarray);
size_t string_size = sizeof(mystring);
You can’t perform that action at this time.