Skip to content

Instantly share code, notes, and snippets.

View jmg-duarte's full-sized avatar
🤔

José Duarte jmg-duarte

🤔
View GitHub Profile
@jmg-duarte
jmg-duarte / minimal-centos-desktop.sh
Created March 9, 2017 19:35
CentOS Minimal Desktop Support
yum groupinstall "X Window System" "Desktop" "Desktop Platform"
yum install gdm gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
unlink /etc/systemd/system/default.target
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
reboot
@jmg-duarte
jmg-duarte / shrew-vpn-dependecies.sh
Last active April 25, 2017 10:51
Shrew Soft VPN Linux dependecy download script
# Run this as sudo
apt-get install g++
apt-get install build-essential
apt-get install flex
apt-get install libedit2 libedit-dev
apt-get install bison
apt-get install cmake
apt-get install openssl
sudo apt-get install libssl-dev
apt-get install libqt4-dev
const vec4 lightPosition = vec4(0.0, 1.8, 1.3, 1.0);
const vec3 materialAmb = vec3(1.0, 0.0, 0.0);
const vec3 materialDif = vec3(1.0, 0.0, 0.0);
const vec3 materialSpe = vec3(1.0, 1.0, 1.0);
const float shininess = 6.0;
const vec3 lightAmb = vec3(0.2, 0.2, 0.2);
const vec3 lightDif = vec3(0.7, 0.7, 0.7);
const vec3 lightSpe = vec3(1.0, 1.0, 1.0);
precision mediump float;
varying vec4 fColor;
void main() {
// Since all the work is done at the vertex shader,
// simply pass along the interpolated color
gl_FragColor = fColor;
}
precision mediump float;
varying vec4 fPosition;
void main() {
gl_FragColor = abs(fPosition);
}
attribute vec4 vPosition;
attribute vec4 vNormal;
uniform mat4 mProjection;
uniform mat4 mModelView;
varying vec4 fPosition;
void main(){
fPosition = vPosition;
gl_Position = mProjection * mModelView * (vPosition + 0.2 * vNormal);
}
--https://mightybyte.github.io/monad-challenges/pages/ex1-4.html
type Gen a = Seed -> (a, Seed)
randPair :: Gen (Char, Integer)
randPair seed =
let (c, s0) = randLetter seed in
let (i, s1) = rand s0 in
((c, i), s1)
@jmg-duarte
jmg-duarte / loader.py
Created May 7, 2018 10:18
A single line loader
def console_loader():
import time
import sys
for i in range(100):
sys.stdout.write('\r{}'.format(i))
sys.stdout.flush()
time.sleep(0.5)
def hash(v, size):
return abs(v) % size
def simple_zero_sum(arr):
_hash = lambda v: abs(v) % len(arr)
changes = 1
while changes > 0:
changes = 0
for idx, value in enumerate(arr):
# Colors (Monokai Pro)
colors:
# Default colors
primary:
background: '#2D2A2E'
foreground: '#FCFCFA'
# Normal colors
normal:
black: '#403E41'