Skip to content

Instantly share code, notes, and snippets.

BA steakknife

Block or report user

Report or block steakknife

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 foo.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
</head>
<body>
</body>
</html>
@steakknife
steakknife / inv_sqrt.c
Created Apr 5, 2019
Quake III fast invsqrt()
View inv_sqrt.c
/* https://www.beyond3d.com/content/articles/8 */
float InvSqrt (float x){
float xhalf = 0.5f*x;
int i = *(int*)&x;
i = 0x5f3759df - (i>>1);
x = *(float*)&i;
x = x*(1.5f - xhalf*x*x);
return x;
}
@steakknife
steakknife / q_rsqrt.c
Last active Apr 5, 2019
Quake 3 fast sqrt
View q_rsqrt.c
/* http://fabiensanglard.net/3dfx_sst1/index.html */
float Q_rsqrt(float number) {
long i;
float x2, y;
const float threehalfs = 1.5f;
x2 = number * 0.5f;
y = number;
i = * (long*) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
View gist:615f08981c9b18271ec3600c6995a31a
Tue Mar 12 01:21:42 2019
*** Panic Report ***
panic(cpu 1 caller 0xffffff801a5dad90): "trying to interlock destroyed mutex (0xffffff8045132840)"@/BuildRoot/Library/Caches/com.apple.xbs/Sources/xnu/xnu-4903.241.1/osfmk/i386/locks_i386.c:2817
Backtrace (CPU 1), Frame : Return Address
0xffffff8035343690 : 0xffffff801a5aeb0d
0xffffff80353436e0 : 0xffffff801a6e8653
0xffffff8035343720 : 0xffffff801a6da07a
0xffffff8035343790 : 0xffffff801a55bca0
0xffffff80353437b0 : 0xffffff801a5ae527
View derparser.rb
class Derives
def initialize
raise "Cannot construct an abstract base class"
end
def call(s)
return nullable? if s.empty?
c = s.slice!(0)
derive(c).(s)
end
View reflex.rb
class Reflex < Formula
desc "The regex-centric, fast and flexible scanner generator for C++"
homepage "https://www.genivia.com/doc/reflex/html"
# This project is master-stable, no releases (yet)
url "https://github.com/Genivia/RE-flex.git"
version "1.0.12"
depends_on "autoconf" => :build
depends_on "coreutils" => :build
depends_on "gawk" => :build
depends_on "grep" => :build
View playground.rs
#![allow(dead_code, unused_macros)]
use std::fmt::Debug;
trait MusicElement: MusicElementClone + Debug {
fn duration(&self) -> f32;
}
trait MusicElementClone {
fn clone_box(&self) -> Box<MusicElement>;
}
@steakknife
steakknife / lib.rs
Last active Jan 4, 2019
AtomTable singleton in Rust
View lib.rs
#[macro_use]
extern crate lazy_static;
use std::collections::HashMap;
use std::sync::{Mutex, Arc};
lazy_static! {
static ref table: Arc<Mutex<AtomTable>> = {
Arc::new(Mutex::new(AtomTable::new()))
};
View subshell_example.c
/*
* $ F=1 ./a.out F
* $
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void main(int argc, char **argv) {
if (fork() == 0) {
char buf[256];
View gist:763e9b93c5a6663518135ef87facdf09
SYSCALL(args) = return
[2018-10-17 21:35:08] [NOTICE] Source [public-resolvers.md] loaded
[2018-10-17 21:35:08] [NOTICE] dnscrypt-proxy 2.0.17
[2018-10-17 21:35:08] [NOTICE] Dropping privileges
[2018-10-17 21:35:08] [FATAL] Unable to reexecute [/usr/local/opt/dnscrypt-proxy/sbin/dnscrypt-proxy]
open("/dev/dtracehelper\0", 0x2, 0xFFFFFFFFEFBFEDC0) = 3 0
ioctl(0x3, 0x80086804, 0x7FFEEFBFEBD0) = 0 0
close(0x3) = 0 0
access("/AppleInternal/XBS/.isChrooted\0", 0x0, 0x0) = -1 Err#2
bsdthread_register(0x7FFF5C753418, 0x7FFF5C753408, 0x2000) = 1073742047 0
You can’t perform that action at this time.