This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def divide_to_chunks(input_list, chunks_n): | |
| for i in range(0, len(input_list), chunks_n): | |
| yield input_list[i:i + chunks_n] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. :cd {path to root directory} | |
| ==If looking to replace Sam== | |
| 2. :vimgrep /Sam/gj **/* | |
| 3. :cfdo %s/Sam/Bob/gc | update | |
| Source: https://vi.stackexchange.com/questions/2776/vim-search-replace-all-files-in-current-project-folder | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://serverfault.com/questions/810636/how-to-manage-dns-in-networkmanager-via-console-nmcli | |
| Here is the command to modify an existing connection. | |
| nmcli con mod $connectionName ipv4.dns "8.8.8.8 8.8.4.4" | |
| connectionName can be found by command: nmcli con. In the question case, it will be "System eth0" | |
| If you want to ignore automatically configured nameservers and search domains, ie the settings passed from DHCP. | |
| nmcli con mod $connectionName ipv4.ignore-auto-dns yes | |
| Finally, to enable the changes, bring the connection down then up: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| from django.db.models.signals import post_save | |
| from django.dispatch import receiver | |
| from django.utils import timezone | |
| from django.contrib.auth.models import AbstractBaseUser, BaseUserManager | |
| from django.contrib.auth.models import PermissionsMixin | |
| from phonenumber_field.modelfields import PhoneNumberField | |
| from simple_email_confirmation.models import SimpleEmailConfirmationUserMixin | |
| from core.constants import NAME_MAX_LENGTH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" GIT_SSH_COMMAND="ssh -i ~/.ssh/xxx -vvv" pip install -r requirements.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| PREMAIL_STYLE_LIST = [ | |
| 'premail_ck_style_align_left', | |
| 'premail_ck_style_align_right', | |
| 'premail_ck_style_figcaption_image', | |
| 'premail_ck_style_img_image' | |
| ] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <!-- saved from url=(0021)https://unam.re/b/23/ --> | |
| <html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title> | |
| unam.re | Fixing chinese Bluetooth dongle for Linux | |
| </title> | |
| <meta name="description" content="Hacking and random thoughts"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def sort_func(my_list): | |
| # Iterate each item in list and swap positions if 1st item is greater than 2nd item | |
| # If swapping happens set start_from_beginning to True para magulit uli from start na magcheck ng order | |
| start_from_beginning = True | |
| while start_from_beginning: | |
| start_from_beginning = False | |
| for i in range(0, len(my_list) - 1): | |
| #1st iteration i.e my_list[i+1] = 'yes we goo'; my_list[i+1][-1] = 'o' | |
| # my_list[i] = 'i am z' ; my_list[i+1][-1] = 'z' | |
| # 'o' < 'z' = TRUE -> do SWAPPING |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution: | |
| def lengthOfLongestSubstring(self, s: str) -> int: | |
| ref_string = s | |
| words = [] | |
| word = '' | |
| for first_cursor in list(s): | |
| for letter in ref_string: | |
| if letter in word: | |
| words.append(word) | |
| word = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Definition for singly-linked list. | |
| # class ListNode: | |
| # def __init__(self, val=0, next=None): | |
| # self.val = val | |
| # self.next = next | |
| class Solution: | |
| def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: | |
| # Add the values | |
| # if values is more than 10 carry over | |
| # if not continue adding the next nodes |
NewerOlder