Skip to content

Instantly share code, notes, and snippets.

@intrueder
intrueder / terminal-prompt-git-branch-zsh.md
Created July 30, 2023 19:15 — forked from reinvanoyen/terminal-prompt-git-branch-zsh.md
Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh)

Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh)

Updated for MacOS Big Sur | Monterey | Ventura

screenshot

Install

Open ~/.zshrc in your favorite editor and add the following content to the bottom.

function parse_git_branch() {
@intrueder
intrueder / build.yml
Created December 9, 2020 16:14 — forked from youhide/build.yml
GitHub Actions - Build for Windows, MacOS, Linux and release on tag.
name: Node CI
on:
push:
tags:
- 'v*'
jobs:
upload-release:
@intrueder
intrueder / aslr_dep.py
Last active May 18, 2020 20:51 — forked from Ayrx/aslr_dep.py
Script to check if a DLL has been compiled with ASLR and DEP support. Inspired by http://security.stackexchange.com/questions/43681/how-can-i-detect-or-inventory-all-dlls-that-dont-use-aslr
import argparse
import os
import pefile
class DllCharacteristics():
def __init__(self, flags):
# collecting IMAGE_DLLCHARACTERISTICS
self.TERMINAL_SERVER_AWARE = bool(flags & 0x8000)
self.GUARD_CF = bool(flags & 0x4000)
@intrueder
intrueder / Optimization-killers.md
Created September 29, 2016 20:15
JS Optimization Killers

#Optimization killers (from https://github.com/petkaantonov/bluebird/wiki/Optimization-killers)

##Introduction

This document will contain advice to avoid writing code that will perform significantly worse than expected. Specifically those patterns that cause V8 (relevant to Node.JS, Opera, Chromium...) to refuse to optimize the affected function.

vhf is also working on a similar project that tries to list every killers in V8 Crankshaft Engine: V8 Bailout Reasons.

###Some V8 background

@intrueder
intrueder / FlipCoin-based C++11 random ID generator
Created June 10, 2014 11:36
Generates random string in format of GUID (i.e. "{00000000-0000-0000-0000-000000000000}")
bool flipСoin()
{
bool side = false;
auto ms = std::chrono::high_resolution_clock::now() + std::chrono::microseconds(10);
while (std::chrono::high_resolution_clock::now() <= ms) side = !side;
return side;
}
unsigned char getRandomBit()
{
Func<double, double>[] F = { Math.Cos, Math.Sqrt, Math.Ceiling, Math.Round };
Func<int, Func<double, double>> foo = bar => F[-~(int)F[bar](bar - .5)];
Console.WriteLine(foo(~-F.Length)(.5 + F[sizeof(float) ^ F.Length](byte.MinValue)));
@intrueder
intrueder / plasma.js
Created November 25, 2013 22:31 — forked from rochal/plasma.js
/***************************************************************************
* Do What THe Fuck You Want To Public Licence 2 *
* *
* JavaScript implementation by Piotr Rochala (http://rocha.la/) *
* Based on C# work of Serge Meunier (http://www.smokycogs.com/) *
* *
* Check this code in action on http://rocha.la/javascript-plasma-fractal *
* *
**************************************************************************/
@intrueder
intrueder / gist:6254346
Last active December 21, 2015 05:08
trying to use MSF
// just a wrapper around double value, indexed
class DV
{
public DV(int i, double value)
{
Id = i;
T = value;
}
public double Id { get; set; }