Skip to content

Instantly share code, notes, and snippets.

View abbasnaqdi's full-sized avatar
:octocat:
Focusing

Abbas Naqdi abbasnaqdi

:octocat:
Focusing
View GitHub Profile
@snhasani
snhasani / disable-apps-verification-on-mac.md
Last active October 24, 2019 21:23
Disable Apps verification in the opening on Mac
  1. Open Terminal App; enter this command
sudo nano /etc/hosts
  1. Drop fllowing line into the end of the file and save it
0.0.0.0 ocsp.apple.com
@abbasnaqdi
abbasnaqdi / high_quality_media_recorder.kt
Last active October 28, 2018 19:31
The MediaRecorder formula is compatible with various Android versions and high-quality audio recorder, Tested on Android 21 to 28
// The MediaRecorder formula is compatible with various Android versions and high-quality audio recorder,
// Tested on Android 21 to 28
mediaRecorder = MediaRecorder().apply {
setAudioSource(MediaRecorder.AudioSource.MIC)
setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC)
setOutputFile(filePath)
setAudioEncodingBitRate(320000)
@vlio20
vlio20 / StatusCode.kt
Last active June 19, 2023 23:56
Kotlin Http Status Codes enum
package oogaday.commons.enums
enum class StatusCode(val code: Int) {
Continue(100),
SwitchingProtocols(101),
Processing(102),
OK(200),
Created(201),
Accepted(202),
@kevinhaitsma
kevinhaitsma / MetricsUtil.kt
Created February 27, 2018 07:36
Convert dp to px and px to dp in Kotlin for Android
import android.content.Context
import android.content.res.Resources
import android.util.DisplayMetrics
/**
* Provides utilities for metrics.
*
* Original at:
* @see <a href="https://stackoverflow.com/a/9563438/8877070">stack overflow answer</a>
*
@kurlov
kurlov / mkv embed soft subtitles
Created December 16, 2017 23:41
ffmpeg command to add .srt based subtitles to an .mkv file
ffmpeg -i in.mkv -f srt -i in.srt -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s srt out.mkv
@mikerr
mikerr / vpn.sh
Created October 16, 2017 12:06
auto setup openvpn on linux
#!/bin/bash
# OpenVPN road warrior installer for Debian, Ubuntu and CentOS
# This script will work on Debian, Ubuntu, CentOS and probably other distros
# of the same families, although no support is offered for them. It isn't
# bulletproof but it will probably work if you simply want to setup a VPN on
# your Debian/Ubuntu/CentOS box. It has been designed to be as unobtrusive and
# universal as possible.
@mrap
mrap / results.md
Created April 6, 2017 20:50
Benchmarks for getting object type in go. http://stackoverflow.com/a/27160765/2078664

go test -bench=. -benchmem

BenchmarkTypeof-4          	10000000	       153 ns/op	      16 B/op	       1 allocs/op
BenchmarkReflectTypeOf-4   	50000000	        27.4 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/mrap/bench/typeof	3.099s