Skip to content

Instantly share code, notes, and snippets.

View dukex's full-sized avatar
✔️
Verified Account

Duke dukex

✔️
Verified Account
View GitHub Profile
@dukex
dukex / ArchLinuxWSL2.md
Created March 2, 2022 16:30 — forked from ld100/ArchLinuxWSL2.md
Steps for setting up Arch Linux on WSL2

Migrating from Ubuntu on WSL to ArchLinux on WSL2

Obsolete notice

This document was created back in 2020 and might not be actual nowadays. It is not supported anymore, so use thise information at your own risk.

Upgrading to WSL 2

  • Download WSL2 Kernel
  • run wsl --set-default-version 2 in windows command line, so that all future WSL machine will use WSL2.
# Adapted from a C# example here:
# http://stackoverflow.com/questions/43224/how-do-i-calculate-a-trendline-for-a-graph
# And thanks to John Esser for helping figure out how to
# calculate the targets to stabilize a negative slope!
class LinearRegression
attr_accessor :slope, :intercept
# Pass in an array of values to get the regression on
@dukex
dukex / sketch.sh
Created February 13, 2017 16:24 — forked from jackbillstrom/sketch.sh
The magic timetraveler script for Sketch trial
#!/bin/sh
echo "Traveling back in time..."
date 0318125013
echo "Opening Sketch..."
open -a Sketch
echo "Traveling to present time..."
ntpdate -u time.apple.com
echo "Done..."
exit 0
@dukex
dukex / 5.c
Last active September 7, 2015 23:37 — forked from anonymous/5.c
Avaliação 1
#include <stdio.h>
int main(int argc, char const *argv[]) {
int a, b, temp;
scanf("%d", &a);
scanf("%d", &b);
temp = a;
a = b;
b = temp;
printf("\n Agora a=%d e b=%d\n", a, b);
# place this file in ~/.config/terminator/config
[global_config]
title_transmit_bg_color = "#d30102"
focus = system
[keybindings]
reset_clear = <Ctrl>R
new_tab = <Ctrl>T
split_horiz = <Ctrl><Shift>E
split_vert = <Ctrl>E
close_term = <Ctrl><Shift>W
@dukex
dukex / Makefile
Last active August 29, 2015 14:09 — forked from vitorbaptista/Makefile
# Baixa resultados do TSE desde 1989 e cria um CSV com os parlamentares eleitos com colunas:
# ano, uf, nome, cargo, situação, partido
ANOS_UF := 1989 1990
ANOS_MUNZONA := 1994 1996 1998 2000 2002 2004 2006 2008 2010 2012 2014
ARQUIVOS_UF := $(patsubst %, VOTACAO_CANDIDATO_UF_%.ZIP, $(ANOS_UF))
ARQUIVOS_MUNZONA := $(patsubst %, votacao_candidato_munzona_%.zip, $(ANOS_MUNZONA))
ARQUIVOS_MUNZONA_DEPENDENCIES := $(patsubst %, votacao_candidato_munzona_%_SP.txt, $(ANOS_MUNZONA))
ARQUIVOS_UF_DEPENDENCIES := $(patsubst %, VOTACAO_CANDIDATO_UF_%, $(ANOS_UF))
@dukex
dukex / gist:5727384
Last active December 18, 2015 04:39 — forked from lucianosousa/gist:5726640
var humanize_time = function(time){
return time > 9 ? time : "0"+time;
}
var milliseconds = 17916;
date = new Date(milliseconds);
humanize_time(date.getUTCMinutes()) + ':' + humanize_time(date.getUTCSeconds());
nowadays: 00:17
expected: 00:17
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'machinist/active_record'
require 'machinist/caching/active_record'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
spec_support = Rails.root.join("spec/support/**/*.rb")