Skip to content

Instantly share code, notes, and snippets.

Avatar

Ankur Sinha sanjayankur31

View GitHub Profile
View npm-freeze.sh
function npm-freeze() {
# npm ls | grep -E "^(├|└)─" | cut -d" " -f2 | awk -v quote='"' 'BEGIN { FS = "@" } ; { print quote $1 quote,":",quote $2 quote"," }' | sed -e 's/ :/:/g'
entries=`npm list --depth=0 -prod true "$@" 2>/dev/null | grep -v "UNMET PEER DEPENDENCY\|peer dep missing" | grep -E "^(├|└)─" | cut -d" " -f2`
echo '"dependencies" : {'
for entry in ${entries}; do
if [[ $entry =~ ^@.* ]]; then
# echo $entry
echo $entry | awk -v quote='"' -v attherate='@' 'BEGIN { FS = "@" }; { print quote attherate $1$2 quote,":",quote $3 quote"," }'
else
@narate
narate / create-hotspot.md
Last active Oct 18, 2021
Create Wi-Fi Hotspot on Linux using nmcli
View create-hotspot.md

Create a Wi-Fi hotspot on Linux using nmcli

Original post : https://unix.stackexchange.com/a/310699

nmcli con add type wifi ifname wlan0 con-name Hostspot autoconnect yes ssid Hostspot
nmcli con modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
nmcli con modify Hostspot wifi-sec.key-mgmt wpa-psk
nmcli con modify Hostspot wifi-sec.psk "veryveryhardpassword1234"
@sanjayankur31
sanjayankur31 / sqldeveloper-fedora25.rst
Last active Nov 16, 2016
Using SQL Developer off campus on Fedora 25 Linux
View sqldeveloper-fedora25.rst

VPN access

In a terminal:

sudo openconnect --juniper uhvpn.herts.ac.uk

It'll ask for credentials. Staff will use: <your studynet id>@staff while students will use: <your studynet id>@student

View modernpaste.diff
diff --git a/fpaste b/fpaste
index 7a2eefe..d33461a 100755
--- a/fpaste
+++ b/fpaste
@@ -20,7 +20,7 @@ VERSION = '0.3.8.1'
USER_AGENT = 'fpaste/' + VERSION
SET_DESCRIPTION_IF_EMPTY = 1 # stdin, clipboard, sysinfo
# FPASTE_URL = 'http://fpaste.org/'
-FPASTE_URL = 'http://paste.fedoraproject.org/'
+FPASTE_URL = 'http://modernpaste.fedorainfracloud.org/api/paste'
@matthewbednarski
matthewbednarski / mimeapps.list
Created Mar 11, 2015
Instruct xdg to use mutt as default email application. Both files go in ~/.local/share/applications
View mimeapps.list
[Default Applications]
x-scheme-handler/mailto=mutt.desktop;
@mbbx6spp
mbbx6spp / README.md
Last active Oct 12, 2021
Gerrit vs Github for code review and codebase management
View README.md

Gerrit vs Github: for code review and codebase management

Sure, Github wins on the UI. Hands down. But, despite my initial annoyance with Gerrit when I first started using it almost a year ago, I am now a convert. Fully. Let me tell you why.

Note: This is an opinionated (on purpose) piece. I assume your preferences are like mine on certain ideas, such as:

  • Fast-forward submits to the target branch are better than allowing merge commits to the target branch. The reason I personally prefer this is that, even if a non-conflicting merge to the target branch is possible, the fact that the review/pull request is not up to date with the latest on the target branch means feature branch test suite runs in the CI pipeline reporting on the review/PR may not be accurate. Another minor point is that forced merge commits are annoying as fuck (opinion) and clutter up Git log histories unnecessarily and I prefer clean histories.
  • Atomic/related changes all in one commit is something worth striving for. Having your dev
@XVilka
XVilka / TrueColour.md
Last active Oct 20, 2021
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

Most updated version is always available at termstandard/colors repository.

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit truecolor: "888" colors (aka 16 million)
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active Oct 20, 2021
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
View 01-generate-ed25519-ssh-key.sh
#!/bin/bash
# generate new personal ed25519 ssh key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
eval "$(ssh-agent -s)"
View gist:6119146
sudo yum -y install python-virtualenv
virtualenv my-venv
source my-venv/bin/activate
git clone url-for-bloom
cd bloom
python setup.py develop
./bin/bloom-generate
@rcoup
rcoup / rsync_parallel.sh
Created Apr 10, 2013
Parallel-ise an rsync transfer when you want multiple concurrent transfers happening,
View rsync_parallel.sh
#!/bin/bash
set -e
# Usage:
# rsync_parallel.sh [--parallel=N] [rsync args...]
#
# Options:
# --parallel=N Use N parallel processes for transfer. Defaults to 10.
#
# Notes: