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
//&>/dev/null;x="${0%.*}";[ ! "$x" -ot "$0" ]||(rm -f "$x";gcc -o "$x" "$0")&&exec "$x" "$@" | |
main(){float A,B,P,Q,X,Y,d;int i,D=80,n=3120;for(X=-2.,Y=-1.5,d=6./D;B=2*A | |
*B+Y,A=P-Q+X,n;((P=A*A)+(Q=B*B)>4||++i>D)&&putchar(*((n--%D?X+=d/2,i<D?i%11 | |
:11:(X=-2.0,Y+=d,12))+"Mandelbrot! \n"))&&(A=B=P=Q=i=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
template <typename T> | |
class stack_array { | |
public: | |
__attribute__((always_inline)) stack_array(size_t length) | |
: ptr_{new (static_cast<T *>(alloca(sizeof(T) * length))) T[length]}, | |
length_{length} {} | |
~stack_array() { | |
for (size_t i = 0; i < length_; ++i) { | |
ptr_[i].~T(); |
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
use std::io; | |
use std::fmt; | |
extern crate ndarray; | |
use ndarray::{ArrayView2, aview2}; | |
use Block::*; | |
static I_BLOCKS: [[[Block; 4]; 4]; 4] = [ | |
[[E, E, E, E], |
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
#!/bin/bash | |
while [[ $# > 0 ]] | |
do | |
key="$1" | |
case $key in | |
-o|-out) | |
OUT=1 | |
shift |
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
# produces: Plug 'user/repo' | |
for d in ./*/ ; do (cd "$d" && git config --get remote.origin.url | sed -r "s@.*github\.com[:/](.+/.+)\.git@Plug '\1'@"); done | sort |
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 <random> | |
inline auto &prng_engine() { | |
thread_local std::random_device rd{}; | |
thread_local std::mt19937 engine{rd()}; | |
return engine; | |
} | |
int main() { | |
thread_local int32_t thead_number = 1; |
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
// clang++ -std=c++14 template.cpp | |
template<typename ...Args> | |
using Function = void(*)(Args *...); | |
template<typename ...Args> | |
void DoThing(Function<Args...> func) { } | |
void IntFunction(int *i) { } |
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
//Un-minified code for bookmarklet that filters orca jobs located in the bay area | |
(function() { | |
var url = 'https://orcahq.com/jobs?location=California%2C+USA&tags=Engineering'; | |
if (decodeURIComponent(window.location.href) !== decodeURIComponent(url)) { | |
window.open(url); | |
return; | |
} | |
var cities = [ | |
'San Francisco', |
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
module.exports = function(maxSpoilsPerChannel) { | |
return function(data, spoils) { | |
var channelId = data.channel_id, | |
channelName = data.channel_name, | |
originalText = data.text.trim(); | |
var result = { | |
username: data.user_name, | |
channel: '', | |
text: '' |
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
using UnityEngine; | |
using System.Collections; | |
public class LightprobDecode : MonoBehaviour { | |
public Renderer ReferenceRenderer; | |
public Transform DirLightTransform; | |
void Awake () { |
NewerOlder