Skip to content

Instantly share code, notes, and snippets.

View sofianhw's full-sized avatar
💭
I may be slow to respond.

Sofian Hadiwijaya sofianhw

💭
I may be slow to respond.
View GitHub Profile
@jboner
jboner / latency.txt
Last active July 16, 2024 16:04
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@nsbingham
nsbingham / local-dnsserver.md
Last active June 5, 2023 21:44
Testing a CNAME

Setting up a local DNS server with bind on OSX Mavericks

This is really just an approach for locally testing DNS changes, which can easily be done with a HOSTS file if the change involves an IP address, but gets a bit trickier when things like CNAMEs are involved. This is only meant to test locally off a single machine.

  1. Install bind using homebrew

    brew install bind

  2. Follow the installation steps to start up bind

@sparrc
sparrc / phabricator_readme.md
Last active March 25, 2024 05:59
Phabricator Ubuntu Installation Guide

Phabricator Ubuntu Installation Guide

This is a supplement to the official Phabricator Installation Guide, because their guide will leave you with all kinds of permission and config errors and ~15,000 setup issues on startup.

Install bonus packages:

# apt-get install mercurial subversion python-pygments sendmail imagemagick

Create necessary users and add phd-user to sudoers:

@joshdover
joshdover / README.md
Last active September 28, 2023 21:38
Idiomatic React Testing Patterns

Idiomatic React Testing Patterns

Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.

Setup

I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern that gives great defaults for each test example but allows every example to override props when needed:

@Biswa96
Biswa96 / Remove_MIUI_Bloatware.CMD
Last active June 26, 2024 17:22
Remove bloatware applications from MIUI ROM in Xiaomi phones
@echo off
set /p Y=Enter adb.exe folder path:
cd /d %Y%
adb devices
pause
for %%X in (
"com.amazon.appmanager"
"com.android.browser"
"com.android.chrome"
"com.android.email"
@gurayops
gurayops / rastgele.py
Created May 15, 2020 11:51
A pseudo-random number API with Python and Falcon, serving by Gunicorn inside the code.
from gunicorn.app.base import BaseApplication
import falcon
import random
import os
import time
waitTime = int(os.environ.get('WAIT_TIME', '2'))
class RandomGenerator(object):
def on_get(self, request, response):
@CapMousse
CapMousse / 01-going-sff.md
Last active July 10, 2024 15:41
[Going SFF] A buildlog for the Aklla A4 Pro #SFF #Aklla #Buildlog

Going SFF

Since I saw the Dan A4 and viewed different video about using this case, I always wanted to build myself an SFF PC. The idea of having a very powerful pc in such a tiny space always impress me.

But the problem with SFF PC is that parts used to build this type of PC are difficult to find and can be expensive, even more with this pandemic and components shortage. And because I already bought a Zotac RTX 3080 Amp Holo, it can't fit in the Dan A4 or even the Ghost S1. This card is simply too huge.

Using a big graphics card limits the choice for cases. Sub-10L cases with 2.5 slots in height and length of 318 mm are not common. The only mainstream case supporting this kind of GPU is the FormD T1, but have fun trying to find one.

Now enter AliExpress or Taobao: You can find many clones of different brands of SFF cases. You can get a Velka 5 clone, the [Lz-a4 (4,1L)](https://item.taobao

/*
* Starter Project for WhatsApp Echo Bot Tutorial
*
* Remix this as the starting point for following the WhatsApp Echo Bot tutorial
*
*/
"use strict";
// Access token for your app