Skip to content

Instantly share code, notes, and snippets.

View luni3359's full-sized avatar

Luni luni3359

View GitHub Profile
@mcho421-snippets
mcho421-snippets / unittest_test.py
Created December 7, 2012 22:02
Python: Unit test example
import random
import unittest
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.seq = range(10)
def test_shuffle(self):
# make sure the shuffled sequence does not lose any elements
@leovoel
leovoel / basic_bot.py
Last active January 25, 2024 04:19
discord.py's basic_bot.py converted to use "cogs".
from discord.ext import commands
description = '''An example bot to showcase the discord.ext.commands extension
module.
There are a number of utility commands being showcased here.'''
# this specifies what extensions to load when the bot starts up
startup_extensions = ["members", "rng"]
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active July 26, 2024 14:30
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@mihow
mihow / load_dotenv.sh
Last active July 25, 2024 04:35
Load environment variables from dotenv / .env file in Bash
# The initial version
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
# My favorite from the comments. Thanks @richarddewit & others!
set -a && source .env && set +a
@carsonip
carsonip / fcitx.md
Created May 14, 2018 03:23
Install fcitx in Linux Mint 18.3 (Ubuntu 16.04)
sudo apt install fcitx fcitx-config-gtk fcitx-frontend-all fcitx-ui-classic fcitx-ui-qimpanel fcitx-libs-qt fcitx-libs-qt5 fcitx-config-gtk2 fcitx-libs-dev fcitx-frontend-qt4 fcitx-frontend-qt5 fcitx-ui-light
echo 'export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export QT4_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx' >> ~/.xprofile

Install quick classic:

@alecgerona
alecgerona / dual_boot_arch_windows.md
Last active March 21, 2024 11:46
Dual Boot install Arch Linux in a Windows 10 preinstalled laptop

Notes: This install was done on MSI GL62M 7REX, ASUS FX503v, and Lenovo Y540 laptops and doesn't implement a secured partition for simplicity and ease of use. Use at your own discretion.

Since the laptop has an SSD, I'd like to install Arch Linux on the SSD as well. Unfortunately, Windows' installation has the whole drive occupied so it needs to be shrunk

  1. Boot into Windows and go into "Create and format hard disk partitions" in Control Panel.
  2. Free up some space in the SSD.

At this point we now have an unallocated disk space. We need to make this space usable by making it of file system type RAW

  1. While still in the Disk Management window, select the unallocated space and create a simple volume in it. Don't assign a path/letter to it, use the whole space, and don't format the drive.
@AXVin
AXVin / hotreload.py
Last active March 8, 2024 16:43
Cog for reloading extensions as they are edited
import os
import pathlib
import discord
from discord.ext import commands, tasks
# put your extension names in this list
# if you don't want them to be reloaded
IGNORE_EXTENSIONS = []