Skip to content

Instantly share code, notes, and snippets.

View ivan-magda's full-sized avatar
🌏
Working on the way

Ivan Magda ivan-magda

🌏
Working on the way
View GitHub Profile
@ivan-magda
ivan-magda / PSPDFThreadSafeMutableDictionary.m
Created April 9, 2020 16:38 — forked from steipete/PSPDFThreadSafeMutableDictionary.m
Simple implementation of a thread safe mutable dictionary. In most cases, you want NSCache instead, but it can be useful in situations where you want to manually control what is evicted from the cache in low memory situations.**Warning:** I only use this for setting/getting keys. Enumeration is not thread safe here and will still throw exception…
//
// PSPDFThreadSafeMutableDictionary.m
//
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@ivan-magda
ivan-magda / libdispatch-efficiency-tips.md
Created February 23, 2020 13:52 — forked from tclementdev/libdispatch-efficiency-tips.md
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

I suspect most developers are using the libdispatch inefficiently due to the way it was presented to us at the time it was introduced and for many years after that, and due to the confusing documentation and API. I realized this after reading the 'concurrency' discussion on the swift-evolution mailing-list, in particular the messages from Pierre Habouzit (who is the libdispatch maintainer at Apple) are quite enlightening (and you can also find many tweets from him on the subject).

My take-aways are:

@ivan-magda
ivan-magda / ARQLThumbnailGenerator.swift
Last active February 13, 2020 11:37 — forked from warrenm/ARQLThumbnailGenerator.swift
Generating thumbnail images of 3D model files for use with AR QuickLook
import Foundation
import SceneKit
class ARQLThumbnailGenerator {
private let device = MTLCreateSystemDefaultDevice()!
/// Create a thumbnail image of the asset with the specified URL at the specified
/// animation time. Supports loading of .scn, .usd, .usdz, .obj, and .abc files,
/// and other formats supported by ModelIO.
@ivan-magda
ivan-magda / id2vec_legacy.ipynb
Created May 31, 2019 09:38 — forked from vmarkovtsev/id2vec_legacy.ipynb
Source code identifier embeddings - legacy demonstration
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[
{
"id":1,
"poll_id": 1,
"type": "poll_started",
"time": 1,
"episode": 1,
"episode_time": 180,
"subject" : {
"title": "Buffalo bills",
We can't make this file beautiful and searchable because it's too large.
2.49837 0.7625998 -0.41463705 0.74808 -0.984809 0.212696 -0.982626 1.98065 -0.067708 -0.808898 -3.048525 -0.206514 -0.564054 -1.06774 2.009544 -1.54157 0.3084404 -0.1453412 -0.3682949 -1.181298 -1.954458 0.5936875 -0.007925 -1.18609 -1.076712 0.441208 -0.6149327 -0.6737745 -0.548164 -0.678282 -0.979549 0.3398381 1.200101 -0.1549723 -1.5517351 0.4523386 0.812903 0.616082 0.508288 -0.6328517 0.833386 -0.02063 1.281967 0.034627 -0.11587 1.74212 -0.013191 -0.05503 -0.6040632 2.549117 -0.6947036 1.576232 0.106304 0.1398028 -0.748427 -0.250538 -1.028614 0.306609 2.27516 0.176498 -0.2508784 -0.512642 0.870953 -0.6913884 -1.339646 -0.349643 -0.633111 -1.294784 0.4119816 -0.68309473 1.085767 0.459174 -0.117124 -2.213827 -0.3425178 0.892288 1.0149716 -0.218539 -0.68179983 -0.826289 -0.889451 -0.845018 -1.362909 0.330857 0.0869631 -0.955294 -2.210034 -0.190876 -1.597112 -0.607222 -0.297053 1.1552849 -0.847756 -0.368633 -0.912897 1.007006 -0.786779 -0.891943 0.435465 -0.935952 -0.388075 -1.347212 -1.53969 -1.377349 1.341
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
get
type
data
name
set
string
value
size
dev
info
{
"embeddings": [
{
"tensorName": "code embeddings",
"tensorShape": [
10000,
150
],
"tensorPath": "https://gist.githubusercontent.com/vanyaland/0ba58a0fd3dc7ba5e446a890c9e3e3e6/raw/4fc965877a5e9400176d166e6ca82599609d0c2b/vectors.100.tsv",
"metadataPath": "https://gist.githubusercontent.com/vanyaland/d90f1ed9b0312551bc57bf7dfa35bd60/raw/30f4d502444afcf429154c0cad42abfa880e9823/labels.100.tsv"
We can't make this file beautiful and searchable because it's too large.
a
aa
aaa
aaaa
aaaaaa
aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaa