Skip to content

Instantly share code, notes, and snippets.

@yen3
yen3 / aarch64_virt_install.sh
Last active May 10, 2024 01:40
aarch64 virt-install commands
#!/bin/bash
rm -rf /home/yen3/ubuntu.qcow2
qemu-img create -f qcow2 /home/yen3/ubuntu.qcow2 10G
virsh undefine ubuntu1604arm64 --nvram
install_from_localtion() {
virt-install -n ubuntu1604arm64 --memory 1024 --arch aarch64 --vcpus 1 \
--disk /home/yen3/ubuntu.qcow2,device=disk,bus=virtio \
@lyc8503
lyc8503 / Bilibili共享大会员.user.js
Last active May 10, 2024 01:24
和朋友共享 Bilibili 大会员账号
// ==UserScript==
// @name Bilibili VIP
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 不给叔叔送钱
// @author You
// @match *://www.bilibili.com/bangumi/play/*
// @match *://www.bilibili.com/video/*
// @connect api.bilibili.com
// @icon https://www.bilibili.com/favicon.ico
@jesstelford
jesstelford / event-loop.md
Last active May 10, 2024 01:23
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

@plembo
plembo / addremstatichostmappinger4.md
Last active May 10, 2024 01:23
Adding and removing static host mappings on EdgeRouter

Adding and removing static host mappings on EdgeRouter

Tested on a Ubiquiti EdgeRouter 4 with dnsmasq enabled for DHCP (and DNS) serving.

These operations can also be carried out in the EdgeRouter web gui with the "DNS host names" Wizard (click the "Wizards" tab and then select "DNS host names" to access).

To see all currently statically mapped hosts:

$ cat /etc/hosts
@epok07
epok07 / CarbonCheatSheet_01.md
Last active May 10, 2024 01:21
Carbon CheatSheet

Source

Get the first Monday of a month (and more)

This is a small cheat sheet for PHP's strtotime function, which can be used to convert textual sentences such as "next Friday" and "last Monday" into UNIX timestamps and formatted dates.

In the examples below, I've used the format "j, d-M-Y", which will give you something like: Monday, 17-Aug-2015. You can change this to your format of choice

@nikAizuddin
nikAizuddin / NASMx86: Allocate heap memory
Created October 12, 2014 22:58
Example using brk() system call for dynamic memory allocations
; 1 2 3 4 5 6 7
;01234567890123456789012345678901234567890123456789012345678901234567890
;=======================================================================
;+---------------------------------------------------------------------+
;| |
;| Example using brk() system call for dynamic memory allocations. |
;| |
;| DON'T CONFUSE that brk() used in C Function is different with brk() |
;| systemcall (systemcall 45 for x86 ASM). |
;| |
@vy-let
vy-let / configuration.nix
Created July 4, 2020 04:16
Setting up NixOS for typical home SMB file sharing
...
{
services.samba = {
enable = true;
syncPasswordsByPam = true;
# You will still need to set up the user accounts to begin with:
# $ sudo smbpasswd -a yourusername
@dsparks
dsparks / Avoiding a loop.R
Created September 12, 2012 13:19
lapply() as an alternative to a multiply-nested loop
# Alternative to a doubly-nested loop
# Imagine I want to perform an operation on a data frame
# once for each combination of two variables, such as Country and Year
# I can do this with a nested loop, or I can do this with (among other
# things) lapply()
# Generate random data:
allCountries <- LETTERS[1:10]
allYears <- 1990:2012
@AndrewMast
AndrewMast / disable_vanguard.vbs
Last active May 10, 2024 01:10
Commands to disable Riot Vanguard when you aren't playing Valorant
' Disables Vanguard from starting when you boot your computer
Call CreateObject("Shell.Application").ShellExecute("cmd.exe", "/c ""sc config vgc start= disabled & sc config vgk start= disabled""", "", "runas")