Skip to content

Instantly share code, notes, and snippets.

View sethmills21's full-sized avatar

Seth Miller sethmills21

View GitHub Profile
@denji
denji / nginx-tuning.md
Last active December 13, 2025 23:44
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@r3econ
r3econ / UIButton+VerticalLayout.h
Last active May 14, 2020 01:30
UIButton category for centering title label and image vertically. The text label is placed below the image.
@interface UIButton (VerticalLayout)
- (void)centerVerticallyWithPadding:(float)padding;
- (void)centerVertically;
@end
@altyus
altyus / gist:9916182
Created April 1, 2014 15:12
Facebook Login With ACAccountStore
- (void)facebookLoginWithCompletion:(void (^)(NSString *userID, NSString *email, NSString *fullName))completion
{
self.accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSDictionary *options = @{
ACFacebookAppIdKey:FACEBOOKAPPID,
ACFacebookPermissionsKey: @[@"read_stream", @"basic_info"],
@tomasbasham
tomasbasham / UIImage+Scale.m
Last active February 1, 2024 19:04
Scale a UIImage to any given rect keeping the aspect ratio
@implementation UIImage (scale)
/**
* Scales an image to fit within a bounds with a size governed by
* the passed size. Also keeps the aspect ratio.
*
* Switch MIN to MAX for aspect fill instead of fit.
*
* @param newSize the size of the bounds the image must fit within.
* @return a new scaled image.
@hfossli
hfossli / CGFloatEqual.m
Created May 14, 2014 11:24
CGFloatEqual
BOOL CGFloatEqual(CGFloat a, CGFloat b, CGFloat accuracy)
{
#if CGFLOAT_IS_DOUBLE
if (fabs(a-b) < accuracy * DBL_EPSILON * fabs(a+b) || fabs(a-b) < DBL_MIN)
{
return YES;
}
#else
if (fabs(a-b) < accuracy * FLT_EPSILON * fabs(a+b) || fabs(a-b) < FLT_MIN)
{
@jmsaavedra
jmsaavedra / ffmpeg_install.md
Last active June 7, 2024 17:33
Install FFmpeg on a Linux Box

Install FFmpeg via CLI on Linux box

These steps walk through installing a static binary of any ffmpeg version on to your linux machine. If you want to compile from source, there are several ways to do so. Here's the official guide. Tested and works on an AWS EC2 Ubuntu instance, but should work on any Linux machine.

  • SSH into your instance and become root
@pkh
pkh / gist:c2e44eb6a11d62b83977
Last active October 5, 2020 13:18
Helpful method to dismiss ALL view controllers presented on top of a root view/navigation controller.
/**
Helpful method to dismiss ALL view controllers presented on top of a
root view/navigation controller.
This method is useful if you have a variable number of view controllers
that you'd need to dimiss to return to a base view. Used for my purposes
from the AppDelegate class during the process of handling the opening of
a URL scheme.
This method also relies on implementing a category on UIViewController
@steipete
steipete / FilterScriptPhase.sh
Created April 27, 2015 16:25
This filter script phase is required to remove unused architectures from your application, which would be flagged as issue during upload to the Apple AppStore. Read more at http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
@michelem09
michelem09 / node-async-mongodb-multiple-updates.js
Last active August 8, 2022 07:49
Gist to update several items in series in a huge MongoDB collection (millions of records) with Node.js and Async module
'use strict';
/**
* Module dependencies.
*/
var async = require('async'),
mongoose = require('mongoose'),
ObjectId = mongoose.Types.ObjectId;
var db = mongoose.connect('mongodb://localhost:27017/test', {}, function (err) {
@gokulkrishh
gokulkrishh / media-query.css
Last active December 9, 2025 18:37
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */