This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.opengl.GLES20; | |
import android.view.Surface; | |
import javax.microedition.khronos.egl.EGL10; | |
import javax.microedition.khronos.egl.EGLConfig; | |
import javax.microedition.khronos.egl.EGLContext; | |
import javax.microedition.khronos.egl.EGLDisplay; | |
import javax.microedition.khronos.egl.EGLSurface; | |
public class SurfaceUtil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "google_cloud_run_v2_service" "my_svc" { | |
name = "my-svc" | |
location = "asia-northeast1" | |
ingress = "INGRESS_TRAFFIC_ALL" | |
template { | |
containers { | |
image = "us-docker.pkg.dev/cloudrun/container/hello" | |
resources { | |
limits = { "cpu": "4000m", "memory" : "2Gi" } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <thread> | |
#include <atomic> | |
#include <assert.h> | |
using namespace std; | |
static atomic<int> a = 0; | |
static atomic<int> b = 0; | |
static atomic<int> A = 0; | |
static atomic<int> B = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
import java.util.List; | |
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
public class Poly extends JPanel { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static BOOL isKeyFrame(CMSampleBufferRef sample) | |
{ | |
auto a = CMSampleBufferGetSampleAttachmentsArray(sample, 0); | |
if (CFArrayGetCount(a) > 0) { | |
CFBooleanRef value; | |
auto b = CFDictionaryGetValueIfPresent | |
((CFDictionaryRef) CFArrayGetValueAtIndex(a, 0) | |
, kCMSampleAttachmentKey_NotSync | |
, reinterpret_cast<const void **>(&value)) | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { ReactElement, useMemo } from "react" | |
import hljs from "highlight.js" | |
import 'highlight.js/styles/dark.css' | |
export function Code(props: { lang: string, text: string }): ReactElement { | |
const { value } = useMemo(() => | |
hljs.highlight(props.lang, trimMargin(props.text)), | |
[props.lang, props.text] | |
) | |
return <pre className="hljs"><code dangerouslySetInnerHTML={{ __html: value }} /></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
LLVM_OBJDUMP = "objdump" | |
options = %w( | |
--no-leading-addr | |
--no-show-raw-insn | |
--symbolize-operands | |
--x86-asm-syntax=intel | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "json" | |
# https://github.com/brendangregg/FlameGraph | |
FG_SCRIPTS = raise "`FG_SCRIPTS` must be set by hand." | |
if ARGV.empty? | |
$stderr.puts("Usage: ruby kperf.rb $POD [ $CONTAINER ] > out.svg") | |
exit(-1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mach/mach.h> | |
// http://stackoverflow.com/questions/8223348/ios-get-cpu-usage-from-application | |
double getCurrentCPUUsage() | |
{ | |
thread_array_t threads; | |
mach_msg_type_number_t threadCount; | |
if (task_threads(mach_task_self(), &threads, &threadCount) != KERN_SUCCESS) { | |
return -1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "mysql2" | |
require "pp" | |
def connect(iso: nil) | |
db = Mysql2::Client.new( | |
host: "127.0.0.1", | |
username: "root", | |
password: '', | |
database: 'test' | |
) |
NewerOlder