This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
def get_power_circumcenter(S, R): | |
R_sqr = R ** 2 | |
Sp = S[1:] - S[0] | |
Sp_norm_sqr = numpy.sum(Sp ** 2, axis = 1) | |
U = ((Sp_norm_sqr + R_sqr[0] - R_sqr[1:]) / (2 * Sp_norm_sqr))[:, None] * Sp + S[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import scipy.integrate as integrate | |
def get_disk_mask(N): | |
def F(x): | |
return (1 - x ** 2) ** .5 | |
# Build a quarter | |
M = N // 2 | |
quarter = numpy.zeros((M, M)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_z_line_triangles_intersections_generator(triangles): | |
# Precompute everything that is independent from the ray origin | |
Z = numpy.array([0., 0., 1.]) | |
tri_AB = triangles[:, 1] - triangles[:, 0] | |
tri_AC = triangles[:, 2] - triangles[:, 0] | |
tri_H = numpy.cross(Z, tri_AC) | |
tri_a = numpy.sum(tri_AB * tri_H, axis = 1) # dot product along axis 0 | |
# Remove all triangles on a plane parallel to the ray |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
def zyx_to_quaternion(z_angle, y_angle, x_angle): | |
cos_x, sin_x = numpy.cos(x_angle / 2), numpy.sin(x_angle / 2) | |
cos_y, sin_y = numpy.cos(y_angle / 2), numpy.sin(y_angle / 2) | |
cos_z, sin_z = numpy.cos(z_angle / 2), numpy.sin(z_angle / 2) | |
return numpy.array([ | |
cos_x * cos_y * cos_z - sin_x * sin_y * sin_z, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
base16_rgb_map = { | |
"base00" : (0x15, 0x15, 0x15), # Default Background | |
"base01" : (0x20, 0x20, 0x20), # Lighter Background (Used for status bars, line number and folding marks) | |
"base02" : (0x30, 0x30, 0x30), # Selection Background | |
"base03" : (0x50, 0x50, 0x50), # Comments, Invisibles, Line Highlighting | |
"base04" : (0xb0, 0xb0, 0xb0), # Dark Foreground (Used for status bars) | |
"base05" : (0xd0, 0xd0, 0xd0), # Default Foreground, Caret, Delimiters, Operators | |
"base06" : (0xe0, 0xe0, 0xe0), # Light Foreground (Not often used) | |
"base07" : (0xf5, 0xf5, 0xf5), # Light Background (Not often used) | |
"base08" : (0xac, 0x41, 0x42), # Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nord_rgb_map = { | |
"nord0" : (0x2e, 0x34, 0x40), # dark 1 (darkest) | |
"nord1" : (0x3b, 0x42, 0x52), # dark 2 | |
"nord2" : (0x43, 0x4c, 0x5e), # dark 3 | |
"nord3" : (0x4c, 0x56, 0x6a), # dark 4 | |
"nord4" : (0xd8, 0xde, 0xe9), # bright 1 | |
"nord5" : (0xe5, 0xe9, 0xf0), # bright 2 | |
"nord6" : (0xec, 0xef, 0xf4), # bright 3 (brightest) | |
"nord7" : (0x8f, 0xbc, 0xbb), # blue 1 (closest to green) | |
"nord8" : (0x88, 0xc0, 0xd0), # blue 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
solarized_rgb_map = { | |
"base03" : (0x00, 0x2b, 0x36), | |
"base02" : (0x07, 0x36, 0x42), | |
"base01" : (0x58, 0x6e, 0x75), | |
"base00" : (0x65, 0x7b, 0x83), | |
"base0" : (0x83, 0x94, 0x96), | |
"base1" : (0x93, 0xa1, 0xa1), | |
"base2" : (0xee, 0xe8, 0xd5), | |
"base3" : (0xfd, 0xf6, 0xe3), | |
"yellow" : (0xb5, 0x89, 0x00), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ETH_IT=enp3s0 | |
WLAN_IT=wlan0 | |
is_eth_used=$(cat /sys/class/net/${ETH_IT}/carrier) | |
is_wlan_used=$(cat /sys/class/net/${WLAN_IT}/carrier) | |
if [ "$is_eth_used" -eq 1 ]; then # wired network is carrying | |
icon="" #uF6FF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
is_ac_powered=$(cat /sys/class/power_supply/AC0/online) | |
batt_capacity=$(cat /sys/class/power_supply/BAT0/capacity) | |
if [ "$is_ac_powered" -eq 1 ]; then | |
icon="" #uF1E6 | |
else | |
if [ "$batt_capacity" -gt 80 ]; then | |
icon="" #uF240 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
icon="" | |
mem_str=$(free -h | awk '/^Mem/ { print $3 "/" $2 }' | sed s/i//g) | |
echo $icon $mem_str |