Skip to content

Instantly share code, notes, and snippets.

View creativcoder's full-sized avatar

creativcoder creativcoder

View GitHub Profile
.-/+oossssoo+/-. creativcoder@autobot
`:+ssssssssssssssssss+:` --------------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 21.04 x86_64
.ossssssssssssssssssdMMMNysssso. Host: ZenBook UX425EA_UX425EA 1.0
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 5.11.0-37-generic
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 26 mins
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 2616 (dpkg), 22 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: zsh 5.8
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Resolution: 1920x1080
ossyNMMMNyMMhsssssssssssssshmmmhssssssso DE: GNOME 3.38.4
@creativcoder
creativcoder / main.rs
Last active November 5, 2023 13:23
Merge k sorted arrays in Rust
// Blog post: https://creativcoder.dev/merge-k-sorted-arrays-rust
// Merge 2 sorted arrays
fn merge_2(a: &[i32], b: &[i32]) -> Vec<i32> {
let (mut i, mut j) = (0, 0);
let mut sorted = vec![];
let remaining;
let remaining_idx;
loop {
if a[i] < b[j] {
@creativcoder
creativcoder / rust-arduino-blink.sh
Last active August 21, 2020 04:06
Linker error when using an infinite range.
@creativcoder
creativcoder / test.rs
Last active August 27, 2017 17:33
In components/script/test.rs
use app_units::Au;
use style::servo::media_queries::{ExpressionKind, Range};
use style::media_queries::{MediaQuery, MediaQueryType};
use style::media_queries::{Expression};
use style::values::specified::{Length, NoCalcLength, AbsoluteLength};
pub fn test_media_query(len: i32) -> MediaQuery {
// try this updated line below, we just imported AbsoluteLength which is an enum and use its Px variant
let length = Length::NoCalc(NoCalcLength::Absolute(AbsoluteLength::Px(len)));
let expr = Expression(ExpressionKind::Width(Range::Max(length)));

Keybase proof

I hereby claim:

  • I am creativcoder on github.
  • I am creativcoder (https://keybase.io/creativcoder) on keybase.
  • I have a public key whose fingerprint is 92EA 6E57 FD2C DE78 09C5 63B8 D4EF 102E F4C8 3AC4

To claim this, I am signing this object:

@creativcoder
creativcoder / main.rs
Created November 14, 2016 21:09
Sized bound on Function
use std::marker::Sized;
struct Tee;
trait T: {
fn foo(&self) {
bar(&self)
}
}
@creativcoder
creativcoder / gist.md
Last active July 28, 2016 13:27
Provision a trusted worker to the serviceworkerglobalscope, on invoking run_serviceworker_scope from ServiceWorkerManager thread.

Approach:

  • The service worker manager will send a message to constellation with, its sender and a pipeline id, and a scope_url.

  • The constellation on receiving the message will find the pipeline and send a message to its containing script thread passing the SW manager sender.

  • The script_thread on receiving the message will query its TLS ServiceWorkerRegistration (by scope_url) and retrieve the Trusted<ServiceWorker> by calling get_trusted_worker() on ServiceWorkerRegistration object , and send the Trusted<ServiceWorker> to the SW manager using the sender which it gets from the constellation.

So is this approach going in right direction ?

@creativcoder
creativcoder / README.md
Created March 13, 2016 07:53 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@creativcoder
creativcoder / CallPython.cs
Created November 15, 2015 14:26
Passing arguements from C# to python
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CallPython
{
@creativcoder
creativcoder / Sublime Text License Key
Last active August 29, 2015 14:28
Sublime Text 2 License Key, Sublime Text 3 License Key, Sublime Text Full Version.
Tags: Sublime Text 2 License Key, Sublime Text 3 License Key, Sublime Text Full Version
Go to menu Help > Enter License.
----- BEGIN LICENSE -----
J2TeaM
2 User License
EA7E-940282
45CB0D8F 09100037 7D1056EB A1DDC1A2