Skip to content

Instantly share code, notes, and snippets.

View jctaoo's full-sized avatar
😀
I'M READY

jcupupup jctaoo

😀
I'M READY
View GitHub Profile
@lkraider
lkraider / avcodec_sample.c
Created February 17, 2011 16:37
ffmpeg thumbnailer - extract frame, scale and save it to disk
// avcodec_sample.0.5.0.c
// Original source:
// http://web.me.com/dhoerl/Home/Tech_Blog/Entries/2009/1/22_Revised_avcodec_sample.c.html
//
// A small sample program that shows how to use libavformat and libavcodec to
// read video from a file.
//
// This version is for the 0.4.9+ release of ffmpeg. This release adds the
// av_read_frame() API call, which simplifies the reading of video frames
/**
* Format a date like YYYY-MM-DD.
*
* @param {string} template
* @param {Date=} [date]
* @return {string}
* @license MIT
*/
function formatDate(template, date) {
var specs = 'YYYY:MM:DD:HH:mm:ss'.split(':');
@tomysmile
tomysmile / mac-setup-redis.md
Last active June 27, 2024 00:23
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@akosma
akosma / webkit.swift
Created October 24, 2016 07:55
Small command-line macOS application using Swift
#!/usr/bin/env xcrun swift
// Adapted from
// https://forums.developer.apple.com/thread/5137
// https://joearms.github.io/2016/01/04/fun-with-swift.html
import WebKit
class ApplicationDelegate: NSObject, NSApplicationDelegate {
internal var window: NSWindow
@coin8086
coin8086 / using-proxy-for-git-or-github.md
Last active June 22, 2024 11:41
Use Proxy for Git/GitHub

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocol you use. And there're two common protocols: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocol. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p
@ngehlert
ngehlert / electron.js
Last active May 4, 2021 06:49
Show open dialog with security scoped bookmarks and access them
const settings = require('electron-settings');
dialog
.showOpenDialog(mainWindow, {
properties: ['openDirectory'],
securityScopedBookmarks: true,
})
.then(({ canceled, filePaths, bookmarks }) => {
// If the dialog was canceled or no directory/file selected we don't want to do anything
if (canceled || filePaths.length === 0) {