Skip to content

Instantly share code, notes, and snippets.

View wention's full-sized avatar

WENTION wention

View GitHub Profile
@wention
wention / ssh-copy-id.ps1
Created July 13, 2023 02:26 — forked from elonmallin/ssh-copy-id.ps1
One-liner ssh-keygen and ssh-copy-id for Windows powershell
ssh-keygen && cat $env:userprofile/.ssh/id_rsa.pub | ssh user@linuxserver 'cat >> .ssh/authorized_keys'
@wention
wention / fix_packer_parallel
Created October 11, 2022 06:24 — forked from gildas/fix_packer_parallel
Fix packer error: couldn't find Parallels Tools for ... flavor after upgrading Parallels
# After upgrading Parallels Desktop, often, this command (used by the packer parallels driver):
# mdfind kMDItemCFBundleIdentifier == com.parallels.desktop.console
# will return not only one path, but a list of the old one(s) and the one:
# /opt/homebrew-cask/Caskroom/parallels-desktop/11.0.2-31348/Parallels Desktop.app
# /opt/homebrew-cask/Caskroom/parallels-desktop/11.1.0-32202/Parallels Desktop.app
#
# Maybe one day the packer team will fix their code and use only the highest version in that list,
# Until then we have to fix the list by ourselves:
mdfind kMDItemCFBundleIdentifier == com.parallels.desktop.console
@wention
wention / jail.conf
Created September 27, 2021 06:27 — forked from AysadKozanoglu/jail.conf
fail2ban nginx 404 400 403 444 filter /etc/fail2ban/filter.d/nginx-4xx.conf enable
# to enable this filter add to jail.conf following (/etc/fail2ban/jail.conf)
# Thanks to -> TheBarret
[nginx-4xx]
enabled = true
port = http,https
logpath = /var/log/nginx/access.log
maxretry = 3
set ignorecase
set smartcase
set scrolloff=3 " 3 lines above/below cursor when scrolling
" Emulated Plugins
set surround
" Copy to system clipboard as well
set clipboard+=unnamed
@wention
wention / mount-qcow2-lvm-image.sh
Created May 12, 2019 07:01 — forked from pshchelo/mount-qcow2-lvm-image.sh
List of commands to mount/unmount a qcow2 image conatining LVM partitions.
# kudos to dzaku at consolechars.wordpress.com
### MOUNT qcow2 image with lvm partitions
# ensure nbd can handle that many partitions
sudo modprobe nbd max_part=8
# present image as block device through NBD
sudo qemu-nbd --connect=/dev/nbd0 <image.qcow2>
@wention
wention / Xresources
Created December 11, 2016 09:29 — forked from tuhaihe/Xresources
Xterm configure file ~/.Xresources, add Chinese font support
!xrdb ~/.Xresources
!xterm font and locale
xterm.locale:true
xterm.utf8: true
xterm*utf8Title:true
xterm*fontMenu*fontdefault*Label:Default
xterm*faceName:Menlo:antialias=true:pixelsize=13
xterm*faceNameDoublesize:WenQuanYi Micro Hei Mono:pixelsize=13:antialias=true
@wention
wention / hash.c
Created December 10, 2016 08:23 — forked from tonious/hash.c
A quick hashtable implementation in c.
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
struct entry_s {
char *key;
char *value;
#include <stdio.h>
#include <string.h>
#include <pulse/pulseaudio.h>
// Field list is here: http://0pointer.de/lennart/projects/pulseaudio/doxygen/structpa__sink__info.html
typedef struct pa_devicelist {
uint8_t initialized;
char name[512];
uint32_t index;
char description[256];
@wention
wention / option_templete.sh
Created December 2, 2015 02:07 — forked from babarot/option_templete.sh
Command line option parser templete for bash
#!/bin/bash
PROGNAME=$(basename $0)
VERSION="1.0.0"
usage() {
echo "Usage: $PROGNAME [OPTIONS] [FILE]"
echo " This script is ~."
echo
echo "Options:"