Skip to content

Instantly share code, notes, and snippets.

@valteu
valteu / ubuntu_egpu
Created August 1, 2023 16:27
Guide to install nvidia eGpu on ubuntu 22.04
DISCLAIMER
This might break your current partition, no guarantees for any damages these steps might cause
System: MSI summit with i7 1280P, RTX 3070, Razer Core X
1. install nvidia driver:
- sudo apt-get install nvidia-driver-525-open
2. reboot
3. install eGPU switcher:
- download release 0.19.0 egpu-switcher-amd64
- sudo cp Downloads/egpu-switcher-amd64 /opt/egpu-switcher
@darcyparker
darcyparker / vimModeStateDiagram.svg
Last active April 25, 2024 17:28
Vim Modes Transition Diagram in SVG https://rawgithub.com/darcyparker/1886716/raw/eab57dfe784f016085251771d65a75a471ca22d4/vimModeStateDiagram.svg Note, most of the nodes in this graph have clickable hyperlinks to documentation.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mzeryck
mzeryck / mz_invisible_widget.js
Last active April 25, 2024 17:27
A Scriptable script that creates "invisible" widget backgrounds based on your iOS wallpaper, and then either uses them as a Scriptable widget background or exports to your camera roll.
/*
MIT License
Copyright (c) 2022 Maxwell Zeryck
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTW
@sirleech
sirleech / gist:1813307
Created February 13, 2012 03:31
Reinstall Apache2 Ubuntu

To replace configuration files that have been deleted, without purging the package, you can do

sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2.2-common

To fully remove the apache2 config files, you should

sudo apt-get purge apache2.2-common
@vankesteren
vankesteren / idealpoint.R
Created April 25, 2024 15:04
Ideal point model in stan
# Ideal point model in stan / R
# example taken & simplified from https://medewitt.github.io/resources/stan_ideal_point.html
library(tidyverse)
library(cmdstanr)
# simulate data: 100 legislators, 150 votes
set.seed(1834)
N_legislators <- 50
N_bills <- 150
@ab5y
ab5y / codegen_filesplit.py
Last active April 25, 2024 17:26
sqlacodegen tool to output stdout to files in models directory
import subprocess
import os
import re
# Run sqlacodegen and capture the stdout output
sqlacodegen_output = subprocess.check_output(["sqlacodegen", "your_database_connection_string"], universal_newlines=True)
# Split the output into individual model sections
model_sections = sqlacodegen_output.split('\n\n')
@wavezhang
wavezhang / java_download.sh
Last active April 25, 2024 17:25
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@superjamie
superjamie / install-ubuntu-luks-lvm.md
Last active April 25, 2024 17:24
How to install Ubuntu with LUKS Encryption on LVM

How to install Ubuntu with LUKS Encryption on LVM

My work requires us to have full-disk encryption, so these are the steps I use.

The basic idea is to create a LUKS-encrypted partition which is used as an LVM Physical Volume.

The GRUB boot partition isn't encrypted, but everything else is.

These steps tested and working on 22.04 (jammy) and 20.04 (focal).

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active April 25, 2024 17:23
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@invictus-ir
invictus-ir / CloudTrail.csv
Last active April 25, 2024 17:23
An overview of CloudTrail events that are interesting from an Incident Response perspective
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 10 columns, instead of 9. in line 7.
"Initial Access","Execution","Persistence","Privilege Escalation","Defense Evasion","Credential Access","Discovery","Lateral Movement","Exfiltration","Impact"
ConsoleLogin,StartInstance,CreateAccessKey,CreateGroup,StopLogging,GetSecretValue,ListUsers,AssumeRole,CreateSnapShot,PutBucketVersioning
PasswordRecoveryRequested,StartInstances,CreateUser,CreateRole,DeleteTrail,GetPasswordData,ListRoles,SwitchRole,ModifySnapshotAttributes ,RunInstances
,Invoke,CreateNetworkAclEntry,UpdateAccessKey,UpdateTrail,RequestCertificate,ListIdentities,,ModifyImageAttribute,DeleteAccountPublicAccessBlock
,SendCommand,CreateRoute,PutGroupPolicy,PutEventSelectors,UpdateAssumeRolePolicy,ListAccessKeys,,SharedSnapshotCopyInitiated,
,,CreateLoginProfile,PutRolePolicy,DeleteFlowLogs,,ListServiceQuotas,,SharedSnapshotVolumeCreated,
,,AuthorizeSecurityGroupEgress,PutUserPolicy,DeleteDetector,,ListInstanceProfiles,,ModifyDBSnapshotAttribute,
,,AuthorizeSecurityGroupIngress,AddRoleToInstanceProfile,DeleteMembers,,ListBuckets,,PutBucketP