Skip to content

Instantly share code, notes, and snippets.

View questionlp's full-sized avatar
🐍
Wait Wait Statsing

Linh Pham questionlp

🐍
Wait Wait Statsing
View GitHub Profile
@willmcgugan
willmcgugan / calculator.css
Created August 30, 2022 15:16
Textual calculator example
Screen {
overflow: auto;
}
#calculator {
layout: table;
table-size: 4;
table-gutter: 1 2;
table-columns: 1fr;
table-rows: 2fr 1fr 1fr 1fr 1fr 1fr;
import sys
import struct
import binascii
from collections import Counter
def u16(b):
return struct.unpack('<H', b)[0]
def p16(x):
return struct.pack('<H', x)
def p32(x):
@acfoltzer
acfoltzer / HOWTO.md
Last active October 6, 2020 11:54
Change git init's default branch name

Change the name of the default branch created by git init

Suppose you want the default branch name created by git init (or tools that shell out to it, like cargo new) to be something other than master. In this example, I'll call it develop.

  1. Add the following to your .gitconfig:

    [init]
        templateDir = ~/.config/git/template/
    
@JeremyMorgan
JeremyMorgan / getbadguys.sh
Created February 8, 2020 04:35
Get a list of IP addresses trying to attack your CentOS server
#/usr/bin/bash
# strings to look for in our file
# Note: you could just parse the whole file. But if you put in a bad password your IP
# could end up on the bad guy list
declare -a badstrings=("Failed password for invalid user"
"input_userauth_request: invalid user"
"pam_unix(sshd:auth): check pass; user unknown"
"input_userauth_request: invalid user"
"does not map back to the address"
"pam_unix(sshd:auth): authentication failure"
@zoilomora
zoilomora / README.md
Last active June 28, 2024 04:59
How to disable cloud-init in Ubuntu

How to disable cloud-init in Ubuntu

Prevent start

  • Create an empty file to prevent the service from starting

      sudo touch /etc/cloud/cloud-init.disabled
    

Uninstall

@zoilomora
zoilomora / README.md
Last active May 13, 2024 16:49
How to disable systemd-resolved in Ubuntu

How to disable systemd-resolved in Ubuntu

Stages

  • Disable and stop the systemd-resolved service:

      sudo systemctl disable systemd-resolved.service
      sudo systemctl stop systemd-resolved
    
  • Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

@lambdalisue
lambdalisue / jupyterhub
Last active July 24, 2022 01:41
A service (init.d) script for jupyterhub
#! /bin/sh
### BEGIN INIT INFO
# Provides: jupyterhub
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start jupyterhub
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@da-n
da-n / gist:9998623
Created April 5, 2014 22:01
Rename a tag in git

Rename a git tag old to new:

git tag new old
git tag -d old
git push origin :refs/tags/old
git push --tags

The colon in the push command removes the tag from the remote repository. If you don't do this, git will create the old tag on your machine when you pull.

-- source http://stackoverflow.com/a/5719854/695454

@gitaarik
gitaarik / git_submodules.md
Last active July 3, 2024 11:45
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.