Skip to content

Instantly share code, notes, and snippets.

View kamalx's full-sized avatar

Kamal Morjal kamalx

  • India
View GitHub Profile
@valosekj
valosekj / string_manipulation.md
Last active February 25, 2025 10:13
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

Define some example string:

$ file=some_file_name.txt
@asis
asis / ruler.js
Last active April 11, 2025 08:51
A simple js ruler
function ruler() {
const ruler = document.createElement("div");
ruler.style.cssText = `
position: absolute;
top: ${window.scrollY + window.innerHeight/2 - 20}px;
left: ${window.scrollX + window.innerWidth/2 - 20}px;
width: 40px;
height: 40px;
background: #ff00006e;
@fnky
fnky / ANSI.md
Last active May 13, 2025 07:41
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@victoriadrake
victoriadrake / lambda-rss-tweeter.go
Last active April 7, 2020 04:11
Tweet RSS feed links for AWS Lambda
package main
import (
"math/rand"
"net/url"
"os"
"time"
"github.com/ChimeraCoder/anaconda"
"github.com/Sirupsen/logrus"
@diaz-de-berenguer
diaz-de-berenguer / app.js
Created February 5, 2018 19:00
Removing a User from an array
// Define WebSocket using ws library
const WebSocket = require('ws');
// Initialise wss as a new Websocket Server running in port 8989
const wss = new WebSocket.Server({ port: 8989 });
// Array of users currently logged in. Serves as the Database.
var users = [];
// This is the code that will run on the server when a new client is connected to
@p3t3r67x0
p3t3r67x0 / prefixed-properties.md
Last active October 31, 2020 15:16
Be aware that every rendering engine has its own implementation of prefixed properties. As extensions are made part of the standard, the unprefixed identifier is then substituted.

Prefixed style properties

-ms-accelerator

The -ms-accelerator property sets or retrieves a string that indicates whether the object represents a keyboard shortcut.

-ms-accelerator: false | true
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active February 25, 2025 22:27
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {

Cactus Blog Plugin

Setup

Enable the blog plugin by renaming blog.disabled.py to blog.py in your site's plugins directory.

Create a directory called posts in your site's pages directory.

Basic usage

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 13, 2025 06:11
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@EmranAhmed
EmranAhmed / 1. main.css
Last active January 11, 2024 01:29
CSS Responsive breakpoint, Media Query break point
/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
}