Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Nick Kapliev nkapliev

🎯
Focusing
View GitHub Profile
@nkapliev
nkapliev / getftree.sh
Created Jun 28, 2016
Amazing fractal tree on bash
View getftree.sh
# @see https://www.hackerrank.com/challenges/fractal-trees-all
# Creating a Fractal Tree from Y-shaped branches
#
# This challenge involves the construction of trees, in the form of ASCII Art.
#
# We have to deal with real world constraints, so we cannot keep repeating the pattern infinitely.
# So, we will provide you a number of iterations, and you need to generate the ASCII version
# of the Fractal Tree for only those many iterations (or, levels of recursion). A few samples are provided below.
#
# Input Format
@nkapliev
nkapliev / Makefile
Last active Mar 19, 2020
Linux kernel 4.4+ netfilter packet capturing boilerplate.
View Makefile
obj-m += ip_mac_packet_logger.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
install:
insmod ip_mac_packet_logger.ko
View HOW_TO_MAKE_A_RASPBERRY-PI_ROUTER.md
@nkapliev
nkapliev / test_1.cpp
Last active Dec 7, 2017
Compilation error if field class does not have default constructor and the field was not initialized during pre-constructor initialization.
View test_1.cpp
#include <iostream>
class Point {
public:
int x;
int y;
Point() {
std::cout << "A point has been initialized by default constructor" << std::endl;
@nkapliev
nkapliev / getCharsWidth.html
Last active Feb 16, 2017
How to compute chars width? 2 ways: DOM & Canvas
View getCharsWidth.html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
var getTextWidthDOM = function(text, fontStyle) {
View avito.ru browser protection =)
(function(x/**/) {
(function(f){
(function a(){
try {
function b(i) {
if(
(''+(i/i)).length !== 1 ||
i % 20 === 0
) {
(function(){}).constructor('debugger')();
View gcd.js
var gcd = function(a, b) {
var coef = 1;
while (
a !== b &&
a !== 0 &&
b !== 0 &&
a !== 1 &&
b !== 1
) {
View polish_calculator.cpp
#include <iostream>
#include <stdio.h>
using namespace std;
class cStack
{
private:
int A[255];
int ptr;
public:
View range.js
Array.apply(null, {length: N}).map(Number.call, Number)
View unix group rename
for f in aaa*; do mv $f $(echo $f | sed 's/^aaa/bbb/g'); done