Skip to content

Instantly share code, notes, and snippets.

View ferhaterata's full-sized avatar
:octocat:

Ferhat Erata ferhaterata

:octocat:
View GitHub Profile
// Primitive hash function that for a string returns a positive 32 bit int
// Do not use in production, use murmur3 or fnv1
// You can improve this by changing 5 to 31
Object.defineProperty(String.prototype, 'hashCode', {
value: function() {
var hash = 0, i, chr;
for (i = 0; i < this.length; i++) {
chr = this.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer

VSCode

  1. Open Command Palette ⇧⌘P or F1
  2. Select Preferences: Open Keyboard Shortcuts (JSON)
  3. keybindings.json will opened
  4. Add below
    {
        "key": "ctrl+alt+c",
 "command": "workbench.action.terminal.sendSequence",
@MattPD
MattPD / analysis.draft.md
Last active May 30, 2024 08:11
Program Analysis Resources (WIP draft)
@0xjac
0xjac / private_fork.md
Last active June 3, 2024 13:37
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@TheRayTracer
TheRayTracer / main.cpp
Created April 1, 2014 04:56
A simple implementation of a Bloom Filter using two hash functions. A Bloom Filter is used to test whether an element is a member of a set. False positive matches are possible, but false negatives are not; i.e. a query returns either "possibly in set" or "definitely not in set". This sample shows an example of a false positive.
#include <iostream>
#include <bitset>
#include <vector>
#include <cassert>
namespace std { }
using namespace std;
typedef size_t (*pHashFunc)(const char*);
@gitaarik
gitaarik / git_submodules.md
Last active June 3, 2024 03:52
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.