Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
☕️

Suresh sureshg

🚀
☕️
View GitHub Profile
@sureshg
sureshg / renew-gpgkey.md
Created Jun 10, 2022 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key
View renew-gpgkey.md

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@sureshg
sureshg / build.gradle.kts
Created Apr 14, 2022 — forked from mcpiroman/build.gradle.kts
Compose for Desktop with Proguard setup
View build.gradle.kts
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
buildscript {
dependencies {
classpath("com.guardsquare:proguard-gradle:7.2.1")
}
}
repositories {
@sureshg
sureshg / latency.txt
Created Jun 16, 2020 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
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
@sureshg
sureshg / openssl_commands.md
Created Feb 18, 2020 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys
View openssl_commands.md

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@sureshg
sureshg / Regex.md
Last active Jul 13, 2018
Catastrophic Backtracking
View Regex.md
@sureshg
sureshg / convert to pkcs 8.md
Created Jun 20, 2018 — forked from markscottwright/convert to pkcs 8.md
How to convert a java private key from PKCS#1 encoding to PKCS#8
View convert to pkcs 8.md

I had some historical key material data in pkcs#1 format that needed to be in pkcs#8 for input into another system. Here's how to do it, using BouncyCastle:

import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.DERObject;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import java.security.PrivateKey;
@sureshg
sureshg / projectDependencyGraph.gradle
Created Jun 9, 2018
Gradle project dependency graph
View projectDependencyGraph.gradle
task projectDependencyGraph {
doLast {
def dot = new File(rootProject.buildDir, 'project.dot')
dot.delete()
dot << 'digraph {\n'
dot << " graph [label=\"${rootProject.name}\\n \",labelloc=t,fontsize=30];\n"
dot << ' node [style=filled, fillcolor="#bbbbbb"];\n'
dot << ' rankdir=TB;\n'
@sureshg
sureshg / keybase.md
Created Jun 11, 2017
My Keybase Proof
View keybase.md

Keybase proof

I hereby claim:

  • I am sureshg on github.
  • I am suresh (https://keybase.io/suresh) on keybase.
  • I have a public key ASD8u-c3VMPka4yOWW5gIiwIpdyKn01ITOTj-WRklYLQBAo

To claim this, I am signing this object:

View Glyphs.kt
/**
* Glyph object provides Unicode glyphs as well as it's plain ASCII alternatives.
* All ASCII glyphs are guaranteed to be the same number of characters as the
* corresponding Unicode glyphs, so that they line up properly when printed on
* a terminal. The orginal data file is taken from "Dart term_glyph" project.
*
* @author Suresh
*
* @see https://github.com/dart-lang/term_glyph
*/
@sureshg
sureshg / JMM.java
Created Jun 12, 2016
Java Memory Model Tests
View JMM.java
class DataRace {
// Make volatile
boolean ready = false;
int answer = 0;
void thread1() {
// Spin Lock
while(!ready);
assert answer == 42
}