Skip to content

Instantly share code, notes, and snippets.

@cho45
cho45 / sine.js
Created December 12, 2019 02:48
//#!node
const sleep = (n) => new Promise( (resolve) => setTimeout(resolve, n) );
const asciichart = require('asciichart')
const screen = {
clear: function () {
console.log('\x1b[2J');
},
@nadavrot
nadavrot / Matrix.md
Last active April 26, 2024 08:28
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@cho45
cho45 / github-widget.js
Created February 28, 2012 00:00
Expand any github api to HTML.
// Eg.: http://cho45.github.com/tasscss/
(function () {
var scripts = document.getElementsByTagName('script');
var script = scripts[scripts.length-1];
var container = document.createElement('div');
script.parentNode.insertBefore(container, script);
var callback; do {
callback = 'jsonp' + Math.floor(Math.random() * 0xffff);
@julianrubisch
julianrubisch / convert_to_webp.rb
Last active April 26, 2024 08:27
Ruby Oneliners to convert images to webp and generate thumbnails
require 'fileutils'
# Loop through all .jpg and .png files in the current directory
Dir.glob("{*.jpg,*.png}").each do |img|
# Construct the output filename with .webp extension
output_filename = "#{File.basename(img, File.extname(img))}.webp"
# Execute ffmpeg command to convert the image
system("ffmpeg -i '#{img}' '#{output_filename}'")
end
@jnappy
jnappy / readme.md
Last active April 26, 2024 08:27
ADI Sample Lesson Plan
title type duration creator competencies
Mastering Control Flow and Loops
lesson
1:35
name city
Kristen Tonga
NYC
Programming
@ipovos
ipovos / processes-and-threads.md
Last active April 26, 2024 08:27
"Processes & Threads" (Answer and attribution were generated by ChatGPT: Open AI GPT-3.5)

Prompt

You are a computer scientist, VP of engineering at microprocessor design company. You know how x86 and ARM architectures work. You know all about how computers work!

Explain to me, as for computer science student in the first year of studing at university, what is a computer "process" and what is a "thread" and how they correlates.

Answer

Certainly! As a first-year computer science student, understanding the concepts of processes and threads is essential in the field of computing.

@smunakata
smunakata / topics10
Created January 9, 2019 10:14
topics_titles_conference_abstracts(10n)_by5thでは、各トピック上位5件に対して、LDA確率, conference(1文字で表している), title, そして次の行からabstractを記録した
0: ['motion', 'matrix', 'object', 'item', 'function', 'viewpoint', 'point', 'slice', 'agent', 'location']
1: ['grid', 'topic', 'method', 'tracking', 'open', 'lattice', 'set', 'functionality', 'model', 'probability']
2: ['cloth', 'glyph', 'link', 'cycle', 'protein', 'rule', 'rapport', 'phenomenon', 'contact', 'permission']
3: ['community', 'moment', 'multivariate', 'plot', 'invariant', 'slice', 'gesture', 'team', 'training', 'sample']
4: ['segmentation', 'relation', 'ensemble', 'proximity', 'modality', 'fiber', 'ner', 'interviewer', 'bin', 'distortion']
@DougGregor
DougGregor / preventing-data-races.md
Created December 20, 2020 06:49
Preventing Data Races in the Swift Concurrency Model

Preventing Data Races in the Swift Concurrency Model

One of the goals of the concurrency effort is to prevent data races. This document describes the approach taken to preventing data races overall, by categorizing the sources of data races and describing how they are addressed with other proposals in the Swift Concurrency effort.

Data races

A data race occurs when two threads access the same memory concurrently and at least one of the accesses can change the value. Within the safe subset of Swift (e.g., ignoring the use of UnsafeMutablePointer and related types), the memory in question is always a stored property. There are several different categories of stored properties that need to be considered for data races:

  • Global and static stored properties:
@robertcasanova
robertcasanova / list.html
Created February 25, 2012 19:57
Micro Tmpl + RequireJS
<% for ( var i = 0; i < dataObject.length; i++ ) { %>
<article id="<%=dataObject[i].id%>" class="<%=(i % 2 == 1 ? "even" : "")%>">
<figure class="clearfix">
<img src="img/<%=i%>_<%=dataObject[i].profile_image_url%>" alt="<%=dataObject[i].id%>" title="<%=dataObject[i].id%>" />
<figcaption>
<strong><%=dataObject[i].id%></strong>
<span class="text"><%=dataObject[i].text%></span>
<span class="contact">Per contatti: <a href="mailto:<%=dataObject[i].from_user%>"><%=dataObject[i].from_user%></a></span>
</figcaption>
</figure>
@JCSooHwanCho
JCSooHwanCho / Heap.swift
Created September 12, 2020 14:20
swift로 간단하게 구현한 힙
public struct Heap<T> {
var nodes: [T] = []
let comparer: (T,T) -> Bool
var isEmpty: Bool {
return nodes.isEmpty
}
init(comparer: @escaping (T,T) -> Bool) {
self.comparer = comparer