Skip to content

Instantly share code, notes, and snippets.

@c02y
c02y / README
Created June 30, 2018 13:21
emacs+cscope/gtags/etags
find the files containing the obsolete:
such as assoc:
find ~/.emacs.d/ -name "*.el" -exec grep -H "(require 'assoc)" {} \;
# for the differences of cscope ctags, etags, global(gtags, ggtags..)...:
# https://github.com/OpenGrok/OpenGrok/wiki/Comparison-with-Similar-Tools
# etags for small c;cscope for big project
@c02y
c02y / docker-guide.md
Last active May 4, 2021 15:39
Docker guide
  • Docker ** Prepare docker *** install docker package *** start and enable service
    • sudo systemctl start docker.service
    • sudo systemctl enable docker.service ** add permission and group
    • sudo usermod -aG docker $USER ** reboot your computer ** check if docker works
@c02y
c02y / gist:3c672c049335097fb751463971139293
Last active January 10, 2021 11:03
manjaro unable to resize inside virtualbox
https://unix.stackexchange.com/a/536056/22322
To get Auto-Resize Guest Display working you have to use 'VBoxVGA'
Stop VM if installed and running
Choose in VM Setting: Display > Screen > Graphics Controller > 'VBoxVGA'
Save
Start VM with Manjaro - Screen goes black.
hit CTRL+ALT+F2 to enter tty2
logon
@c02y
c02y / Arch-Linux-Installation-Guide.md
Last active January 9, 2021 18:53
Arch Linux Installation Guide

Sources:

  1. Burn the ISO into USB drive if installing it into drive directly
  • dd if=archlinux.iso of=/dev/sda bs=4M status=progress && sync
  1. Install libvirt ovmf packages and reboot if installing it into KVM NOTE: ovmf package and reboot step ensure that boot from UEFI instead of BIOS, otherwise, it would fail during the process when you try to grub-install (install bootloader)
  • choose Fireware of "UEFI x86_84: ... OVMF_CODE.fd" from Overview in VM details of KVM
@c02y
c02y / tig-appimage-guide
Created August 1, 2020 08:24
tig appimage guide
* Create tig appimage
** get tig src file zip or using git into ~/public/tig
** compile
- make
- fix the dependencies
** generate the appimage file
- download linuxdeploy appimage and make it executable
- write the right tig.desktop and log tig.png, the logo can be empty tig.svg file
- ./linuxdeploy.appimage -e ./src/tig -i ./tig.png -d ./tig.desktop --appdir AppDir --output appimage
+ NOTE: in docker, you may unable to run appimage directly
@c02y
c02y / LinkedListCycle.py
Created May 16, 2020 01:43
LinkedListCycle.py
# 141. Linked List Cycle (Easy)
# https://leetcode-cn.com/problems/linked-list-cycle/description/
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
@c02y
c02y / MergeSortedArray.py
Created May 14, 2020 22:26
MergeSortedArray.py
# 88. Merge Sorted Array (Easy)
# https://leetcode-cn.com/problems/merge-sorted-array/description/
from typing import List
class Solution:
def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
"""
Do not return anything, modify nums1 in-place instead.
"""
@c02y
c02y / ValidPalindromeII.py
Created May 14, 2020 19:59
ValidPalindromeII.py
# 680. Valid Palindrome II (Easy)
# https://leetcode-cn.com/problems/valid-palindrome-ii/description/
class Solution:
def validPalindrome(self, s):
if s == s[::-1]:
return True
l, r = 0, len(s) - 1
while l < r:
if s[l] == s[r]:
l, r = l + 1, r - 1
@c02y
c02y / TopDownPrintBinaryTree.py
Created May 13, 2020 19:47
TopDownPrintBinaryTree.py
# https://cyc2018.github.io/CS-Notes/#/notes/32.1%20%E4%BB%8E%E4%B8%8A%E5%BE%80%E4%B8%8B%E6%89%93%E5%8D%B0%E4%BA%8C%E5%8F%89%E6%A0%91
class Node:
def __init__(self, val=0):
self.val = val
self.left = None
self.right = None
class TreeNodes:
def __init__(self):
@c02y
c02y / printMatrixCycle.py
Created January 15, 2020 08:38
29. 顺时针打印矩阵
#!/usr/bin/env python3
# https://cyc2018.github.io/CS-Notes/#/notes/29.%20%E9%A1%BA%E6%97%B6%E9%92%88%E6%89%93%E5%8D%B0%E7%9F%A9%E9%98%B5
class Solution:
def printMatrix(self, matrix):
res = []
while matrix:
res += matrix.pop(0)
if matrix and matrix[0]:
for row in matrix: