Skip to content

Instantly share code, notes, and snippets.

View skycocker's full-sized avatar

Michał Siwek skycocker

  • Kraków, Poland
View GitHub Profile
@kconner
kconner / macOS Internals.md
Last active April 22, 2024 21:28
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@arefaslani
arefaslani / direct_uploads_controller.rb
Last active January 14, 2024 07:08
Active Storage's direct uploads controller
# frozen_string_literal: true
# Creates a new blob on the server side in anticipation of a direct-to-service upload from the client side.
# When the client-side upload is completed, the signed_blob_id can be submitted as part of the form to reference
# the blob that was created up front.
class ActiveStorage::DirectUploadsController < ActiveStorage::BaseController
skip_before_action :verify_authenticity_token, :only => [:create]
def create
blob = ActiveStorage::Blob.create_before_direct_upload!(blob_args)
@skycocker
skycocker / enable_swap.sh
Last active June 9, 2021 14:52
Enable 1G swap space on ubuntu (or pretty much any other linux distro) - useful on small Amazon/Digitalocean instances
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=10
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
sudo sysctl vm.vfs_cache_pressure=50
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active March 1, 2024 14:39
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@aaronash
aaronash / Tweak.xm
Created November 9, 2016 16:03
Theos syntax iOS tweak for 7.1.2 to brute force the lockscreen pincode
@interface SBDeviceLockController : NSObject
+(id)sharedController;
-(BOOL)attemptDeviceUnlockWithPassword:(id)password appRequested:(BOOL)requested;
-(void)_clearBlockedState;
@end
%hook SpringBoard
-(void)applicationDidFinishLaunching:(id)application {
%orig;
@betahikaru
betahikaru / redmine-https-aws.md
Last active September 6, 2020 04:03
Setup Bitnami Redmine on AWS & certbot(Let's Encrypt)

[WIP]Setup Bitnami Redmine on AWS & certbot(Let's Encrypt)

Note: Created at 2016/08/07

Todos

  • Automation refresh by cron

References

  • Let's Encrypt
@gtallen1187
gtallen1187 / scar_tissue.md
Created November 1, 2015 23:53
talk given by John Ousterhout about sustaining relationships

"Scar Tissues Make Relationships Wear Out"

04/26/2103. From a lecture by Professor John Ousterhout at Stanford, class CS142.

This is my most touchy-feely thought for the weekend. Here’s the basic idea: It’s really hard to build relationships that last for a long time. If you haven’t discovered this, you will discover this sooner or later. And it's hard both for personal relationships and for business relationships. And to me, it's pretty amazing that two people can stay married for 25 years without killing each other.

[Laughter]

> But honestly, most professional relationships don't last anywhere near that long. The best bands always seem to break up after 2 or 3 years. And business partnerships fall apart, and there's all these problems in these relationships that just don't last. So, why is that? Well, in my view, it’s relationships don't fail because there some single catastrophic event to destroy them, although often there is a single catastrophic event around the the end of the relation

@andrassomogyi
andrassomogyi / AViewController.h
Created September 25, 2015 09:43
SFSafariViewController Objective-C example
#import <UIKit/UIKit.h>
@import SafariServices;
@interface AViewController : UIViewController
//
// ...
//
@end
@joashp
joashp / openssl_encrypt_decrypt.php
Created September 4, 2015 15:59
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@ed-flanagan
ed-flanagan / install_Spotify.md
Last active December 26, 2017 10:56
Install Spotify Preview on Debian 8 Jessie

Install Spotify Preview on Debian 8 Jessie

Note: Possibly outdated

Note: This is more of a personal reference. You should never install/add keys/libs/programs you yourself don't trust or know are safe.

Check https://www.spotify.com/us/download/linux/ for the official scoop.

Intial Aptitude Install

  1. Add the Spotify repository signing key to be able to verify downloaded packages