Skip to content

Instantly share code, notes, and snippets.

View craftzdog's full-sized avatar
🏠
Working from home

Takuya Matsuyama craftzdog

🏠
Working from home
View GitHub Profile
@jstoone
jstoone / kill-ios-web-content.sh
Last active April 11, 2024 07:41
Kill WebKit.WebContent on Simulator
#/bin/bash
# Find process with name containing 'launchd_sim'
SIMULATOR_PID=$(pgrep launchd_sim)
echo "Simulator PID: $SIMULATOR_PID"
# Find sub-processes for the app's WebViews
WEBKIT_CONTENT_PID=$(pgrep -P $SIMULATOR_PID 'com.apple.WebKit.WebContent')
echo "WebKit WebContent PID(s):"
echo $WEBKIT_CONTENT_PID
@sindresorhus
sindresorhus / esm-package.md
Last active April 26, 2024 03:53
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@hotchpotch
hotchpotch / user_profile.ps1
Last active December 21, 2022 06:28
PowerShell Profile
# PS Modules
Import-Module posh-git
Import-Module oh-my-posh
Import-Module ZLocation
Set-Theme robbyrussell # お好きなテーマ
Set-PSReadLineOption -EditMode Emacs
@okanon
okanon / fuckin_nvidia.md
Last active November 20, 2022 08:16
グラボをNvidia Storeから個人輸入する際にハマった

グラボをNvidia Storeから個人輸入する際にハマった

結論

  • 無事購入できました:joy:
  • 代理店価格(日本価格)より1~2万円ほど安く購入できる
  • 初めて購入するときは結構沼るので注意が必要
  • 必ず在庫通知がメールに届くようにする
  • 万が一キャンセルされたときに、早く返金が欲しいならPaypal決済かつ銀行口座からの引き落としを使え

そんなところです

const val TAG_LENGTH = 16
class EncryptionOutput(val iv: ByteArray,
val tag: ByteArray,
val ciphertext: ByteArray)
fun encrypt(key: SecretKey, message: ByteArray): EncryptionOutput {
val cipher = Cipher.getInstance("AES/GCM/NoPadding")
cipher.init(Cipher.ENCRYPT_MODE, key)
val iv = cipher.iv.copyOf()
@hartator
hartator / dom-to-3d-view.js
Last active February 2, 2024 04:36
dom-to-3d-view.js
function domTo3DView(b, p) {
function l(k, c, b, e, g, d, f) {
return "<div style='position:absolute;-webkit-transform-origin: 0 0 0;" + ("background:" + f + ";") + ("width:" + e + "px; height:" + g + "px;") + ("-webkit-transform:" + ("translate3d(" + k + "px," + c + "px," + b + "px)") + ("rotateX(270deg) rotateY(" + d + "deg)") + ";") + "'></div>"
}
function o(k, c, d, f) {
for (var j = k.childNodes, n = j.length, m = 0; m < n; m++) {
var a = j[m];
if (1 === a.nodeType) {
a.style.overflow = "visible";
@rpalo
rpalo / walle.fish
Created June 23, 2018 18:01
Print a colored Wall-E in your terminal!
function walle
set light_blue C7E2E8
set gray C1C1BD
set light_gray EEE
set dark_gray 565653
set bronze C6973F
set yellow FFE500
set lime C6E80B
set brown 8C5D05
@twilson63
twilson63 / README.md
Created March 13, 2018 00:16
Pouchdb Server with MySQL Backend

PouchDB Server using a MySQL Backend

PouchDB server is a nodejs implementation of CouchDB. Below is the steps to use AmazonRDS and NowJS to deploy your own PouchDB Server. Using MySQL as a persistent backend.

Amazon Web Services

Create a Amazon Web Services Account

https://aws.amazon.com

@NathanFlurry
NathanFlurry / README.md
Last active February 13, 2023 20:58
Inkdrop Import Markdown Files

About

This script will import Markdown files from a folder. It will only import files ending in .md, so it skips folders and images. This will use the file name as the note name. If there is a H1 on the first line, it will remove that line and trim the file in order to remove redundancy.

How to use

  1. Select the notebook you want to import into in the sidebar.
  2. Under Inkdrop, select Developer > Toggle Developer Tools.
  3. Paste this script.
  4. Replace path/to/folder/with/markdown/files/ with a path to the folder with the markdown files in it. Make sure to include the trailing "/".
  5. Ignore the error and please forgive my laziness. If you get a grey screen, just click a few times and the ghost windows will disappear.
@DennisWeidmann
DennisWeidmann / NSImageExtension.swift
Last active January 9, 2023 10:10
Convert NSImage to CVPixelBuffer
extension NSImage {
func pixelBuffer() -> CVPixelBuffer? {
let width = self.size.width
let height = self.size.height
let attrs = [kCVPixelBufferCGImageCompatibilityKey: kCFBooleanTrue,
kCVPixelBufferCGBitmapContextCompatibilityKey: kCFBooleanTrue] as CFDictionary
var pixelBuffer: CVPixelBuffer?
let status = CVPixelBufferCreate(kCFAllocatorDefault,
Int(width),
Int(height),