Skip to content

Instantly share code, notes, and snippets.

@lman
lman / 0_reuse_code.js
Created February 21, 2014 19:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
public class FriendsListActivity extends BaseActivity {
public static final int CONST = 0;
public static final int SOME_CONST = 1;
@InjectView(R.id.list) RecyclerView list;
@InjectView(R.id.another_list) RecyclerView anotherList;
@Inject SomePresenter presenter;
@Inject AnotherPresenter anotherPresenter;
/**
* Created by lman on 02/09/15.
*/
public class Main {
public static void main(String[] args) {
int n = 100;
for (int i=0; i<n; ++i) {
if (i % 3 == 0 && i % 5 == 0) {
System.out.println("withbus = " + i);
@lman
lman / MongoDB_macOS_Sierra.md
Created September 15, 2018 14:28 — forked from nrollr/MongoDB_macOS_Sierra.md
Install MongoDB on Sierra using Homebrew

Install MongoDB on macOS Sierra

This procedure explains how to install MongoDB using Homebrew on macOS Sierra 10.12.
Official MongoDB install documentation: here

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@lman
lman / ToothpickJunit5Mockito.kt
Created July 9, 2019 14:26
Example of toothpick junit5+mockito test
class MyCalendarPresenter @Inject constructor(private val view: IMycalendarView,
private val repository: IUserMemoriesRepository) {
fun onAttach() {
view.showUserMemories(getMemories())
}
fun getMemories(): String {
return "memories"
}
@lman
lman / nginx-tuning.md
Created June 18, 2020 00:02 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

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.

@lman
lman / trial-reset.py
Created October 29, 2022 11:39 — forked from rehannali/trial-reset.py
Trial Reseter for MAC
import os
from pathlib import Path
from sys import argv
class ResetTrial:
path = str(Path().home()) + "/Library/"
file_array = []
dir_array = []
@lman
lman / example.com.conf
Created December 14, 2022 20:49 — forked from donpdonp/example.com.conf
nginx.conf https only with letsencrypt using lego client
# /etc/nginx/sites-enabled/example.com.conf
server {
listen 80;
server_name .example.com;
location / {
return 301 https://$host$request_uri;
}
}