Skip to content

Instantly share code, notes, and snippets.

View malkomalko's full-sized avatar

Robert Malko malkomalko

  • Doximity
  • Atlanta, GA
View GitHub Profile
@malkomalko
malkomalko / default_behaviour.ex
Created August 23, 2024 00:11 — forked from christhekeele/default_behaviour.ex
Behaviours with Defaults for Elixir
defmodule Default.Behaviour do
@moduledoc """
Creates a behaviour that carries its own default implementation.
When used into a behaviour module, when that module in turn is used, all functions
defined on it are given to the using module.
This allows you to have concrete implementations of the behaviour's default functionality
for testing, unlike cramming them all into a __using__ macro.

Keybase proof

I hereby claim:

  • I am malkomalko on github.
  • I am malkomalko (https://keybase.io/malkomalko) on keybase.
  • I have a public key ASBeVeKk-zICqUV_hkY-fdw8Heb0668htuKPSNH9OPo0QAo

To claim this, I am signing this object:

@malkomalko
malkomalko / tcp_flags.txt
Created October 19, 2018 21:40 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@malkomalko
malkomalko / master.vim
Created May 12, 2018 21:41 — forked from gmccreight/master.vim
A script that gives you a playground for mastering vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@malkomalko
malkomalko / .vimrc
Last active September 29, 2021 15:22
" Section: init {{{1
set nocompatible
filetype off
filetype indent plugin on
scriptencoding utf-8
syntax on
runtime macros/matchit.vim
@malkomalko
malkomalko / autocurry.js
Last active August 29, 2015 14:06 — forked from torgeir/javascript-autocurry-partial-application-of-any-level.js
Autocurry functions in javascript
function curry(fn) {
var numargs = fn.length;
return createRecurser([]);
function createRecurser(acc) {
return function () {
var args = Array.prototype.slice.call(arguments);
return recurse(acc, args);
};
}
# Recursively diff two hashes, showing only the differing values.
# By Henrik Nyh <http://henrik.nyh.se> 2009-07-14 under the MIT license.
#
# Example:
#
# a = {
# "same" => "same",
# "diff" => "a",
# "only a" => "a",
# "nest" => {
@malkomalko
malkomalko / scale.rb
Created April 14, 2014 23:31 — forked from caged/scale.rb
# Returns a lambda used to determine what number is at t in the range of a and b
#
# interpolate_number(0, 500).call(0.5) # 250
# interpolate_number(0, 500).call(1) # 500
#
def interpolate_number(a, b)
a = a.to_f
b = b.to_f
b -= a
lambda { |t| a + b * t }
@malkomalko
malkomalko / lisp.c
Created April 5, 2014 14:27 — forked from sanxiyn/lisp.c
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
@malkomalko
malkomalko / Macros.h
Last active May 4, 2017 12:19 — forked from numo16/Macros.h
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define NotificationCenter [NSNotificationCenter defaultCenter]
#define SharedApplication [UIApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x
#define NavBar self.navigationController.navigationBar