Skip to content

Instantly share code, notes, and snippets.

View darkworks's full-sized avatar
🏠
Working from home

darkworks

🏠
Working from home
View GitHub Profile
@darkworks
darkworks / vpn.md
Created October 4, 2018 07:56 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

(A Russian translation of this article can be found here, contributed by Timur Demin.)

Why not?

@darkworks
darkworks / secure_link.php
Last active January 12, 2022 05:55 — forked from bftanase/secure_link.php
generate URL for nginx secure_link #nginx #linux
@darkworks
darkworks / angle-between-points.js
Last active July 14, 2018 09:29 — forked from conorbuck/angle-between-points.js
JavaScript: Find the angle between two points
// FInd Angle between 2 point ... 0 to 90
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
@darkworks
darkworks / color-conversion-algorithms.js
Last active June 21, 2018 07:02 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@darkworks
darkworks / tip.html
Created May 6, 2018 09:52
Center text #css #web
# CSS text-align Property
div.a {
text-align: center;
}
div.b {
text-align: left;
}
@darkworks
darkworks / simple-pagination.js
Created May 2, 2018 16:58 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Canvas Transformation</title>
</head>
<body>
<script>
// Create our canvas and append it to the document body
var stage = document.createElement("canvas");
@darkworks
darkworks / vboxdrvfix.md
Created January 31, 2018 06:38 — forked from PartTimeLegend/vboxdrvfix.md
/etc/init.d/vboxdrv setup Not Found - VirtualBox Fix!

#/etc/init.d/vboxdrv setup Not Found - VirtualBox Fix!

When setting up Virtual Box I was faced with the immortal error telling me to run sudo /etc/init.d/vboxdrv setup. Simple enough, until you're told it doesn't exist.

Thus began my fight to get it working. The fix is here in the hope that it helps someone else.

To follow this guide you need to have a basic understanding of shell commands. If you don't, then just be careful.

First off I like aptitute so let's install it.

@darkworks
darkworks / spectre.c
Created January 5, 2018 06:10 — forked from ErikAugust/spectre.c
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@darkworks
darkworks / array_dupplicate_counter.js
Created June 6, 2017 07:17 — forked from ralphcrisostomo/array_dupplicate_counter.js
Javascript: Count duplicates in an array
/**
Problem:
You have a javascript array that likely has some duplicate values and you would like a count of those values.
Solution:
Try this schnippet out.
*/