Skip to content

Instantly share code, notes, and snippets.

@sunilkum84
sunilkum84 / mirror.sh
Created June 27, 2025 06:37 — forked from tallship/mirror.sh
httrack for mirroring site on archive.org (waybackmachine)
#this is useful for copying snapshotted sites at archive.org
#copied from http://superuser.com/questions/532036/trouble-using-wget-or-httrack-to-mirror-archived-website
#replace ${wayback_url} with the full URL i.e. http://web.archive.org/web/20020705161639/http://kict.iiu.edu.my/
#replace ${domain_name} with the domain name of the site you'r mirroring without the 'http', so kict.iiu.edu.my
httrack\
${wayback_url}\
'-*'\
'+*/${domain_name}/*'\
-N1005\
--advanced-progressinfo\
@sunilkum84
sunilkum84 / daemon.json
Created May 13, 2025 16:16 — forked from paulgwebster-oe/daemon.json
Example Docker daemon.json
{
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"cgroup-parent": "",
"cluster-store": "",
"cluster-store-opts": {},
"cluster-advertise": "",
"debug": true,
@sunilkum84
sunilkum84 / stripcolor
Created March 26, 2025 11:27 — forked from stevenh512/stripcolor
Strip color codes from Rails logs
#!/bin/sh
# Strip color codes from Rails logs
# Examples:
# stripcolor test.log > test.log.nocolor # Save a copy of the log without color
# stripcolor test.log | gist # Gist the log
# stripcolor test.log | pbcopy # Copy the log to the clipboard in OSX
# stripcolor test.log | xclip -selection clipboard # Copy log to clipboard in Linux
cat "$@" | sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g"
@sunilkum84
sunilkum84 / regex-howto.md
Created April 11, 2024 14:51 — forked from cat-lin-morgan/regex-howto.md
Regular Expressions - Regex: A How To For Dummies

Regular Expressions - Regex: A How To For Dummies

Ooohh, cryptic! Ahhh, strange!

confused math lady meme but instead of math its regex. meme by me

Today's Topic

/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/
'http://www.flickr.com/photos/cksample3/4383370998/'
'http://soundcloud.com/decksharks-records/tomaz-del-corazon-charter-service'
'http://soundcloud.com/krizz-luco/klanggefluster-01'
'http://www.youtube.com/watch?v=nlh5pECfpug'
'http://tweetphoto.com/31205172'
'http://yfrog.com/jceclipse8j'
'http://tweetphoto.com/31223684'
'http://www.ustream.tv/channel/dj-wally'
'http://tweetphoto.com/31091156'
'http://yfrog.com/me1066510j'
@sunilkum84
sunilkum84 / clean_code.md
Created July 8, 2023 10:09 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

.
|-- data-representation
|-- db
|-- docker
|-- git
|-- http
|-- latency
`-- terminal
@sunilkum84
sunilkum84 / fix-mtu.sh
Created June 12, 2023 19:46 — forked from henning/fix-mtu.sh
fix-mtu script
#!/bin/bash
# script to find and set the right mtu
#
# Usage
# fix-mtu [INTERFACE]
#
# When not INTERFACE given, wlan0 is used as default.
# check if an interface was given

Regex Tutorial

As a web development student, I have developed a tutorial explaining a specifics of regex so that we can understand the search pattern the regex defines

Summary

A Regex or regular expression is a sequence of characters that define a search pattern. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings. It also looks for input validations. It is a technique commonly developed in theoretical computer science.

We will look a a string of code using regex, this code looks for a match HTML tag.

//Regular Expressions List
//Short Tutorial
\ // the escape character - used to find an instance of a metacharacter like a period, brackets, etc.
. // match any character except newline
x // match any instance of x
^x // match any character except x
[x] // match any instance of x in the bracketed range - [abxyz] will match any instance of a, b, x, y, or z
| // an OR operator - [x|y] will match an instance of x or y