Skip to content

Instantly share code, notes, and snippets.

View kamalx's full-sized avatar

Kamal Morjal kamalx

  • India
View GitHub Profile
@kamalx
kamalx / privatekeysolana.js
Created June 23, 2023 13:51 — forked from Xavier59/privatekeysolana.js
Convert Solana private key from/to base58/uint8array
// exporting from a bs58 private key to an Uint8Array
// == from phantom private key to solana cli id.json key file
// npm install bs58 @solana/web3.js
const web3 = require("@solana/web3.js");
const bs58 = require('bs58');
let secretKey = bs58.decode("[base58 private key here]");
console.log(`[${web3.Keypair.fromSecretKey(secretKey).secretKey}]`);
// exporting back from Uint8Array to bs58 private key
@kamalx
kamalx / 1. main.css
Created June 6, 2023 03:13 — forked from EmranAhmed/1. main.css
CSS Responsive breakpoint, Media Query break point
/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
}
@kamalx
kamalx / string_manipulation.md
Last active June 4, 2023 06:57 — forked from valosekj/string_manipulation.md
Useful string manipulation examples for bash and zsh #blog

Useful string manipulation examples for bash and zsh

I need very often to modify filenames or replace/delete their parts across huge number of files. I was using sed command for these purposes but recently I have found out that all these tasks can be easily done directly in bash (or zsh) because both of them support so called string manipulation operations.

String manipulations

magic incantation what does it do?
${#string} Get string length
@kamalx
kamalx / glass-card-w-svg-gsap-ode-to-phil-goodwin-unfold.markdown
Last active May 30, 2023 20:25
Glass Card w/ SVG + GSAP (ode to Phil Goodwin @ Unfold)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kamalx
kamalx / white-twig-with-16-white-leaves.svg
Created March 4, 2023 07:36
Twig with 16 leaves SVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kamalx
kamalx / ANSI.md
Created October 14, 2022 21:32 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@kamalx
kamalx / 99_bottles_of_beer.dart
Last active November 6, 2020 15:33
99 bottles of beer on the wall (song lyrics)
String bWhat(int n) {
return n != 1 ? 'bottles' : 'bottle';
}
void main() {
for(var i = 99; i > 0; i--) {
((){
int num = i;
String b = bWhat(num);
@kamalx
kamalx / ogprep.sh
Created August 29, 2020 03:13
BULK GENERATING OG IMAGES -- Zach Leatherman: https://www.zachleat.com/web/bulk-og/
# prepare images for og serving
echo "Uses imagemagick."
images="input/*.png"
watermark="watermark.png"
outputDir="output/"
bgColor="#00dc9e"
mkdir tmp/
mkdir $outputDir
@kamalx
kamalx / ID.js
Created February 21, 2018 06:03
ID - a unique ID/name generator for JavaScript
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`