Skip to content

Instantly share code, notes, and snippets.

@kagemusha
kagemusha / go get with private github repo
Created June 13, 2018 16:28
go get with private github repo
1. If you are trying to `go get` a private repo, you need to be able to enter your `username` and `password` from the prompt.
To get the prompt you need to enable the git terminal prompt.
env GIT_TERMINAL_PROMPT=1 go get 'github.com/the-user/the-repo'
2. Because of 2FA you cannot use your password. You need to generate an access token and enter that in the password field
instead (you will want to copy at the clipboard on the token generation page, b/c it will be long). To generate the token, go
to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). Or from the Github UI,
` Setting - Developer Settings - Personal access tokens`
@chriswhong
chriswhong / RadiusMode.js
Created March 1, 2018 12:04
RadiusMode, a custom mode for mapbox-gl-draw for drawing a radius
// custom mapbopx-gl-draw mode that modifies draw_line_string
// shows a center point, radius line, and circle polygon while drawing
// forces draw.create on creation of second vertex
import MapboxDraw from 'mapbox-gl-draw';
import numeral from 'numeral';
import lineDistance from 'npm:@turf/line-distance';
const RadiusMode = MapboxDraw.modes.draw_line_string;
@tegansnyder
tegansnyder / Preventing-Puppeteer-Detection.md
Created February 23, 2018 02:41
Preventing Puppeteer Detection

I’m looking for any tips or tricks for making chrome headless mode less detectable. Here is what I’ve done so far:

Set my args as follows:

const run = (async () => {

    const args = [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-infobars',
rofi usage:
rofi [-options ...]
Command line only options:
-no-config Do not load configuration, use default values.
-v,-version Print the version number and exit.
-dmenu Start in dmenu mode.
-display [string] X server to contact.
${DISPLAY}
-h,-help This help message.
@lfgrando
lfgrando / CsvRegex.cs
Last active February 27, 2021 10:59
CSV regex
(?<=^|,)(\"(?:[^\"]|\"\")*\"|[^,]*)
/*
May be usefull to:
1997,Ford,E350,"ac, abs, moon",30100.00
1999,Chevy,"Venture ""Extended Edition""",,49000.00
1996,Jeep,Grand Cherokee,"MUST SELL!
air, moon roof, loaded",479699.00
*/
@DefiantBidet
DefiantBidet / wrap-as-arg.sublime-snippet
Created May 25, 2017 03:45
sublime text snippet to wrap selection in a function call similar to the existing wrap with tag.
<snippet>
<content><![CDATA[${1:fn}($SELECTION)]]></content>
<tabTrigger>WrapAsArg</tabTrigger>
<description>Wraps Selection With Function Call</description>
</snippet>
@mosquito
mosquito / README.md
Last active May 21, 2025 19:56
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/[email protected]. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@simonmichael
simonmichael / init.el
Last active March 16, 2023 09:30
emacs: simple window splitting policy
;; Try to ensure sensible window splitting, independent of frame and font size.
;; Things I don't want:
;; - excessive horizontal splitting (generally I prefer no more than 2 windows across)
;; - horizontal splitting when frame is tall and narrow (causing eg useless narrow man page formatting)
;; So, aim for a simple policy: popup windows shall be half width in a wide frame,
;; half height in a tall frame.
;;
;; Emacs' window splitting behaviour is complex and must be read carefully.
;; In particular, note: it checks split-window-height first, and if that permits it to
;; split vertically, it does that and split-window-horizontally is ignored.
@Brainiarc7
Brainiarc7 / skylake-tuning-linux.md
Last active May 10, 2025 00:38
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running:

@Eyjafjallajokull
Eyjafjallajokull / README.md
Last active April 8, 2025 15:20
AWS EBS - Find unused snapshots

This script can help you find and remove unused AWS snapshots and volumes.

There is hardcoded list of regions that it searches, adjust the value to suit your needs.

Use snapshot.py snapshot-report to generate report.csv containing information about all snapshots.

snapshot.py snapshot-cleanup lets you interactively delete snapshot if it finds it is referencing unexisting resources.

./snapshots.py --help