Skip to content

Instantly share code, notes, and snippets.

View arajkumar's full-sized avatar
🏡

Arunprasad Rajkumar arajkumar

🏡
View GitHub Profile
@phortuin
phortuin / postgres.md
Last active October 10, 2024 23:00
Set up postgres + database on MacOS (M1)

Based on this blogpost.

Install with Homebrew:

$ brew install postgresql@14

(The version number 14 needs to be explicitly stated. The @ mark designates a version number is specified. If you need an older version of postgres, use postgresql@13, for example.)

@mort3za
mort3za / git-auto-sign-commits.sh
Last active May 28, 2024 20:51
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@earljon
earljon / aws_route53_delete.sh
Created August 15, 2017 08:58
Delete a Route 53 Record Set in AWS CLI
#!/bin/sh
# NOTE:
# Make sure that the value of Name, Type, TTL are the same with your DNS Record Set
HOSTED_ZONE_ID=<YOUR_HOSTED_ZONE_ID>
RESOURCE_VALUE=<YOUR_DNS_RESOURCE_VALUE-ex:IP or dns>
DNS_NAME=<YOUR_DNS_NAME-ex: subdomain.domain.com>
RECORD_TYPE=<DNS_RECORD_TYPE-ex: A, CNAME>
TTL=<TTL_VALUE>
import io
import selectors
import subprocess
import sys
def capture_subprocess_output(subprocess_args):
# Start subprocess
# bufsize = 1 means output is line buffered
# universal_newlines = True is required for line buffering
process = subprocess.Popen(subprocess_args,
import CCairo
class Surface {
private let surface: COpaquePointer
private let cr: COpaquePointer
init(format: cairo_format_t, width: Int, height: Int) {
self.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 240, 80)
self.cr = cairo_create(surface)
}
func writeToPNG(filename: String) {
@tegansnyder
tegansnyder / disable mcafee endpoint protection.md
Last active October 29, 2024 13:49
Disable McAffee Endpoint Protection OSX

method 1

sudo /usr/local/McAfee/AntiMalware/VSControl stopoas

alternatively

sudo defaults write /Library/Preferences/com.mcafee.ssm.antimalware.plist OAS_Enable -bool False
sudo /usr/local/McAfee/AntiMalware/VSControl stop
sudo /usr/local/McAfee/AntiMalware/VSControl reload
@crimeminister
crimeminister / jenkins.md
Last active September 5, 2019 07:08
Triggering Jenkins builds from git hooks (old blog post)

Triggering Jenkins builds from a git hook

I use Jenkins CI to build a number projects as part of a continuous integration system. I wanted to set things up so that, after each commit to a git repository containing one of these projects, the new code would be checked out and rebuilt by Jenkins (as well as collecting metrics and performing various other tasks). It turns out there’s a very easy way to do this using Git hooks and Jenkins remote build triggers.

Start by setting up a remote build trigger in a Jenkins project. This will enable a URL that, when fetched using an HTTP GET request, will cause Jenkins to build the project. To set things up, visit the Configure page for the project in Jenkins and, under Build Triggers, make sure the Trigger builds remotely option is checked. You’ll need to specify an authentication token to pass as a query parameter. I usually use md5sum to generate an MD5 message digest since they’re random(-ish) and URL-friendly. Make note of the URL that is displayed; that’s what you

diff --git a/Source/cmake/FindHarfBuzz.cmake b/Source/cmake/FindHarfBuzz.cmake
index f8ca605..6e77478 100644
--- a/Source/cmake/FindHarfBuzz.cmake
+++ b/Source/cmake/FindHarfBuzz.cmake
@@ -42,5 +42,14 @@ find_library(HARFBUZZ_LIBRARIES NAMES harfbuzz
HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR}
)
+# HarfBuzz 0.9.18 split ICU support into a separate library harfbuzz-icu.
+if ("PC_HARFBUZZ_VERSION" VERSION_GREATER "0.9.17")
@jboner
jboner / latency.txt
Last active November 19, 2024 14:58
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