Skip to content

Instantly share code, notes, and snippets.

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

CuteRat kdepp

🏠
Working from home
View GitHub Profile
@iccir
iccir / openScreenRecordingPreferences.m
Created October 13, 2019 09:21
Open "Screen Recording" preferences on macOS Catalina
static void sOpenScreenRecordingPreferences()
{
CFDataRef passThruData = CFBridgingRetain([@"Privacy_ScreenCapture" dataUsingEncoding:NSUTF8StringEncoding]);
CFArrayRef itemURLs = CFBridgingRetain(@[ [NSURL fileURLWithPath:@"/System/Library/PreferencePanes/Security.prefPane"] ]);
OSStatus err = noErr;
AEDesc passThruDesc = {0};
BOOL needsDispose = NO;
@dagronf
dagronf / ShowSystemPreferencePanes.swift
Last active April 29, 2024 17:21
macOS: Open system preferences at a specified pane using Swift (or Objective-C) using x-apple.systempreferences
// Applescript: tell application "System Preferences" to get anchors of current pane
// Result:
// { anchor "Privacy_Reminders" of pane id "com.apple.preference.security" of application "System Preferences",
// anchor "Privacy_SystemServices" of pane id "com.apple.preference.security" of application "System Preferences",
// anchor "Privacy_Calendars" of pane id "com.apple.preference.security" of application "System Preferences",
// anchor "Firewall" of pane id "com.apple.preference.security" of application "System Preferences",
// anchor "Privacy_Assistive" of pane id "com.apple.preference.security" of application "System Preferences",
// anchor "Privacy_LinkedIn" of pane id "com.apple.preference.security" of application "System Preferences",
// anchor "Privacy_Accessibility" of pane id "com.apple.preference.security" of application "System Preferences",
@tanaikech
tanaikech / submit.md
Last active December 27, 2022 09:26
Enhanced onEdit(e) using Google Apps Script

Enhanced onEdit(e) using Google Apps Script

onEdit(e) which is used for the Edit event on Spreadsheet has the old value as e.oldValue. The specifications for this are as follows.

  1. When an user edited a single "A1" cell, e of onEdit(e) shows hoge for e.oldValue and fuga for e.value.
  2. When an user edited the "A1:A2" multiple cells, e.oldValue and e.value of onEdit(e) are not shown anything.
  3. When an user copied and pasted from other cell, e.oldValue and e.value of onEdit(e) are not shown anything.

This sample script was created to retrieve both the edited values and the old values for the range of edited cells. This is the modified e.oldValue.

@Dayjo
Dayjo / install-poppler-ubuntu.md
Last active February 20, 2024 23:49
How to install Poppler on Ubuntu

First install all these prerequisites for compiling:

sudo apt install g++ autoconf libfontconfig1-dev pkg-config libjpeg-dev libopenjpeg-dev gnome-common libglib2.0-dev gtk-doc-tools libyelp-dev yelp-tools gobject-introspection libsecret-1-dev libnautilus-extension-dev

First download the encoding files (no need to compile these) to the current working directory

wget https://poppler.freedesktop.org/poppler-data-0.4.7.tar.gz
@bachvtuan
bachvtuan / send_sms.js
Last active April 11, 2018 10:25
Send SMS Amazon SNS Nodejs
/**
* @Author: bachvtuan@gmail.com
* to_number: String : user phone number
* message: String : sms message
* func_callback: function : callback function( status )
* Reference links :
* https://gist.github.com/stuartmyles/8099723
* http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html#deleteTopic-property
*/
@raphaelhanneken
raphaelhanneken / NSImageExtensions.swift
Last active August 24, 2023 01:04
NSImage extensions for easy resizing, cropping and saving png images.
//
// NSImageExtensions.swift
//
import Cocoa
extension NSImage {
/// The height of the image.
var height: CGFloat {
@raphaelhanneken
raphaelhanneken / DragAndDropImageView.swift
Last active February 15, 2023 13:29
NSImageView with drag and drop capabilities written in Swift.
//
// DragAndDropImageView.swift
// Iconizer
// https://github.com/raphaelhanneken/iconizer
//
import Cocoa
class DragDropImageView: NSImageView, NSDraggingSource {
/// Holds the last mouse down event, to track the drag distance.
@rain1024
rain1024 / tut.md
Last active May 6, 2024 06:12
Install pdflatex ubuntu

PdfLatex is a tool that converts Latex sources into PDF. This is specifically very important for researchers, as they use it to publish their findings. It could be installed very easily using Linux terminal, though this seems an annoying task on Windows. Installation commands are given below.

  • Install the TexLive base
sudo apt-get install texlive-latex-base
  • Also install the recommended and extra fonts to avoid running into the error [1], when trying to use pdflatex on latex files with more fonts.
@firedfox
firedfox / browser.txt
Created July 7, 2014 06:41
browser & os map
#智能手机浏览器
70 UCBrowser/9.2
70 UCWEB9.2
71 UCBrowser/9.3
71 UCWEB9.3
72 UCBrowser/9.4
72 UCWEB9.4
73 UCBrowser/9.5
73 UCWEB9.5
74 UCBrowser/9.6
@jonathanmorley
jonathanmorley / regex_golf.md
Last active November 16, 2022 17:42 — forked from jpsim/answers.md
Best possible answers collected so far for [Regex golf](http://regex.alf.nu/). === WARNING: SPOILERS ===