Skip to content

Instantly share code, notes, and snippets.

View dudeinthemoon42's full-sized avatar

Bobby Barjasteh dudeinthemoon42

View GitHub Profile
@arniebradfo
arniebradfo / any.component.html
Last active October 22, 2024 18:40
Angular *ngFor recursive list tree template
<h1>Angular 2 Recursive List</h1>
<ul>
<ng-template #recursiveList let-list>
<li *ngFor="let item of list">
{{item.title}}
<ul *ngIf="item.children.length > 0">
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: item.children }"></ng-container>
</ul>
</li>
</ng-template>
@Lauler
Lauler / csspread.py
Created December 14, 2015 18:41
Generate csv file with CS 1.6's and CS: GO's different methods for calculating spread
import random
import math
def cs16():
with open('CS16spread.csv', 'w') as file:
i = 0
file.write("x" + "," + "y" + "\n")
while i < 100000:
@Lauler
Lauler / csgoinacc.py
Last active December 29, 2015 19:04
import math
tickrate = 100
firerate = 0.1 # ak47 firerate (seconds)
seconds = 2 # nr of seconds to run spraying simulation
def inacc():
with open('CSinaccuracypre2.csv', 'w') as file:
@cra0kalo
cra0kalo / ida_dump.c
Created September 11, 2015 15:40
CSGO Decrypt Overwatch
char __thiscall sub_104E1A10(int this, const char *a2, int a3, int a4)
{
int v4; // eax@1
int v5; // edx@2
int v6; // ecx@2
int v7; // eax@5
void *v8; // esp@8
signed int v9; // esi@9
unsigned __int32 v10; // eax@11
int v11; // esi@11
@paulirish
paulirish / bling.js
Last active February 18, 2025 14:08
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
anonymous
anonymous / gist:de6b81c556b5dc7cdc8b
Created February 20, 2015 01:42
Kernel panic in latest OS X in 10 lines of C
#include <unistd.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
#include <mach-o/dyld.h>
int
main (int argc, char * argv[])
{
volatile char * library;
const mach_vm_size_t page_size = getpagesize ();
@alloy
alloy / README.markdown
Created August 8, 2014 09:56
Learn the LLVM C++ API by example.

The easiest way to start using the LLVM C++ API by example is to have LLVM generate the API usage for a given code sample. In this example it will emit the code required to rebuild the test.c sample by using LLVM:

$ clang -c -emit-llvm test.c -o test.ll
$ llc -march=cpp test.ll -o test.cpp
@Flafla2
Flafla2 / Perlin.cs
Last active April 25, 2024 15:04
Improved Perlin Noise Implementation in C#
public class Perlin {
public static double OctavePerlin(double x, double y, double z, int octaves, double persistence) {
double total = 0;
double frequency = 1;
double amplitude = 1;
for(int i=0;i<octaves;i++) {
total += perlin(x * frequency, y * frequency, z * frequency) * amplitude;
amplitude *= persistence;
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
@cfj
cfj / console.reverselog.js
Last active August 21, 2017 10:00
More console.log sillyness
var _log = console.log;
window.console.log = function(log){
_log.call(console, log.reverse ? log.reverse() : typeof log === 'string' ? log.split('').reverse().join('') : typeof log === 'number' ? log.toString().split('').reverse().join('') : typeof log === 'boolean' ? !log : log);
};