Skip to content

Instantly share code, notes, and snippets.

View cuiwm's full-sized avatar
🎯
Focusing

cuiwm cuiwm

🎯
Focusing
  • UK
View GitHub Profile
@Enelar
Enelar / sysctl.conf
Created April 4, 2016 16:04
sysctl.conf
vm.swappiness=90
vm.dirty_ratio=50
vm.dirty_background_ratio=30
vm.dirty_writeback_centisecs=60000
vm.vfs_cache_pressure=150
vm.laptop_mode=1
vm.page-cluster=1
vm.min_free_kbytes=2048
vm.memory_failure_recovery=1
vm.panic_on_oom=1
@Jeraimee
Jeraimee / sysctl.conf
Created June 27, 2012 02:35
sysctl.conf
This sysctl.conf is used on a CentOS 6.2 system doing heavy tcp comms using ActiveMQ.
fs.file-max = 999999
net.core.netdev_max_backlog = 10240
net.core.somaxconn = 10240
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.rp_filter = 1
@yp2800
yp2800 / sysctl.conf
Created February 13, 2014 03:07
sysctl.conf
/etc/sysctl.conf
kernel.ctrl-alt-del=1
kernel.sysrq=0
kernel.panic=10
kernel.core_pattern=/dev/null
kernel.shmmax=262324224
fs.file-max=128000
net.core.wmem_default=200100
net.core.rmem_default=200100
net.core.wmem_max=3202200
@PFortin93
PFortin93 / sysctl.conf
Created January 11, 2017 14:08
Elastic sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
#
# Use '/sbin/sysctl -a' to list all possible parameters.
# Controls IPv4 Security
net.ipv4.ip_forward=0
net.ipv4.conf.all.send_redirects=0
@aburan28
aburan28 / sysctl.conf
Created May 29, 2017 11:02
optimized sysctl.conf
ARCH=$(uname -m)
which bc
if [ $? -ne 0 ]; then
echo "This script require GNU bc, cf. http://www.gnu.org/software/bc/"
echo "On Linux Debian/Ubuntu you can install it by doing : apt-get install bc"
fi
echo "Update sysctl for $host"
@ftkro
ftkro / sysctl.conf
Created November 14, 2014 07:23
Ubuntu sysctl.conf
net.ipv4.ip_forward = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.eth0.send_redirects = 0
net.ipv4.conf.lo.send_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.tcp_fastopen = 0x403
@kandelvijaya
kandelvijaya / PrecisionTimer.swift
Created October 24, 2016 20:41
Precision Timing in iOS/OSX/Swift
//: Playground - noun: a place where code can play
import UIKit
//Most precise time keeper
// for more information on the benchmarks go to www.kandelvijaya.com
func timeBlockWithMach(_ block: () -> Void) -> TimeInterval {
var info = mach_timebase_info()
guard mach_timebase_info(&info) == KERN_SUCCESS else { return -1 }
@piaoger
piaoger / test_mmap_ios.m
Last active July 8, 2020 18:34
mmap on ios
// It's tested on ios 8.2 ..
// Apple document about virtual memory:
// Both OS X and iOS include a fully-integrated virtual memory system that you cannot turn off; it is always on.
// https://developer.apple.com/library/mac/documentation/Performance/Conceptual/ManagingMemory/Articles/AboutMemory.html
// Discussing mmap on ios:
// http://stackoverflow.com/questions/13425558/why-does-mmap-fail-on-ios
// http://stackoverflow.com/questions/9184773/is-there-a-practical-limit-on-the-number-of-memory-mapped-files-in-ios
#include <sys/mman.h>
@erkattak
erkattak / AndroidManifest.xml
Created June 19, 2017 18:47
Android Application Setup for use with Charles Proxy
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config">
% it creates a simple gray image (4x4)
I = [255, 255, 30, 100
255, 50, 90, 20
70, 70, 20, 10
100, 20, 10, 0];
% it converts it to grayscale
I = mat2gray(I);
% shows it
imshow(I);