Skip to content

Instantly share code, notes, and snippets.

View funkyboy's full-sized avatar

Cesare funkyboy

View GitHub Profile
@chockenberry
chockenberry / ContentView.swift
Created April 17, 2024 17:43
NavigationPath Experiments
//
// ContentView.swift
// NavigationTest
//
// Created by Craig Hockenberry on 4/16/24.
//
import SwiftUI
struct OddView: View {
@keith
keith / simctl-commands.txt
Last active December 7, 2022 23:27
All the subcommands of `xcrun simctl` (including ones that aren't listed in `simctl help`) LC_SOURCE_VERSION 776.1 (Xcode 13.0 beta 5)
addmedia
addphoto
addvideo
appinfo
boot
bootstatus
clone
create
darwinup
delete
@muralikg
muralikg / background.js
Last active June 8, 2023 09:19
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
@TomSoderling
TomSoderling / Disable iOS Simulator Incoming Connections Popup.sh
Last active December 14, 2023 10:26
Bash script for turning off the iOS simulator pop-up message
#!/bin/bash
# Script to disable the iOS Simulator app from showing the "Do you want the application xxxx to accept incoming network connections?" pop-up every time the app is run
echo "> Enter password to temporarily shut firewall off"
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
echo "> Add Xcode as a firewall exception"
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/MacOS/Xcode
@joewiz
joewiz / post-mortem.md
Last active September 3, 2023 11:57
Recovery from nginx "Too many open files" error on Amazon AWS Linux

On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:

2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files)

2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...

An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.

  1. * Instead of using su to run ulimit on the nginx account, use ps aux | grep nginx to locate nginx's process IDs. Then query each process's file handle limits using cat /proc/pid/limits (where pid is the process id retrieved from ps). (Note: sudo may be necessary on your system for the cat command here, depending on your system.)
  2. Added fs.file-max = 70000 to /etc/sysctl.conf
@d-ronnqvist
d-ronnqvist / re-enable delete action.markdown
Last active January 6, 2024 07:23
How to break (and re-enable) the native accessibility "delete" action for table views

If you've haven't seen it before, there is a cool accessibility feature in UITableView that allows the user to toggle between different actions. It's really very elegant and it's a powerful and convenient implementation for VoiceOver users on iOS. One could say that it's the VoiceOver version of the swipe-to-delete feature.

To try it out yourselves, open one of the built in apps like Mail or Notes and turn on VoiceOver. If you are afraid to accidentally delete some of your important notes or email, you can also create a new Master-Detail Application in Xcode and run it on your device. Navigate to one of the cells and use the "Rotor" (rotate with two fingers on the screen) to find the "Actions" item. Now you can swipe up and down do toggle between "Activate Item (default action)" and "Delete". If you now double tap, the cell gets deleted instead of selected.

image with actions

This is the default behavior and you get this accessibility out of the box with UITableView.

@freeeve
freeeve / output.txt
Last active April 23, 2019 07:37
database/sql/rows to json...
eve-macbook:~ go run rowstojson.go
[
{
"id": 0,
"name": "Peck Duran",
"street": "Chapel Street",
"city": "Orbin",
"zip": "94999",
"state": "Maine",
"email": "ppppp@bbb.com",
@thetzel
thetzel / inapp.php
Created July 13, 2012 20:01
In App Purchase Verification PHP Code
<?php
function verifyPurchase($transactionid, $productid, $uuid, $sandbox=false) {
$body = @file_get_contents('php://input');
//encode receipt
$body = base64_encode($body);
$receipt = json_encode(array("receipt-data" => $body));
def run_in_background(&block)
Process.fork do
Process.fork do
puts "Launching Background Process"
Daemons.call &block
puts "Background Process has been Launched"
end
exit
end
end
@onedesign
onedesign / mongodb-upstart.sh
Created January 4, 2011 21:29
Ubuntu upstart script for MongoDB with automatic repair
# Ubuntu upstart file at /etc/init/mongodb.conf
pre-start script
mkdir -p /var/lib/mongodb/
mkdir -p /var/log/mongodb/
end script
start on runlevel [2345]
stop on runlevel [06]