Skip to content

Instantly share code, notes, and snippets.

View Nanodragon999's full-sized avatar
🏠
Searching for a remote work.

Norton Nanodragon999

🏠
Searching for a remote work.
  • France
View GitHub Profile
@miguelmota
miguelmota / scrape.py
Created March 23, 2017 17:37
Python Selenium get cookie value
import time
from selenium import webdriver
driver = webdriver.Chrome('./chromedriver')
driver.get('https://ui.lkqd.com/login')
assert 'LKQD' in driver.title
time.sleep(2)
username_field = driver.find_element_by_name('username')
username_field.send_keys('myusername')
@akatrevorjay
akatrevorjay / loc
Last active May 19, 2024 01:31
loc: mlocate + fzf integration
#!/usr/bin/env zsh
#
# loc: mlocate + fzf integration
#
# https://gist.github.com/06dc1238b2fcbfb6c10bbad05ad79bc1
# https://asciinema.org/a/102006
#
# ~ trevorj <[email protected]>
#
setopt pipe_fail err_return err_exit
@kou029w
kou029w / bf.sh
Last active January 5, 2021 02:43
a brainfuck compiler written in bash
#!/bin/bash
grep -o . "$@"|sed '/\./cprintf 0x%x $((m[p]))|xxd -r
/\[/cwhile((m[p]));do
/]/cdone
/</c((p--))
/>/c((p++))
s/[+-]/((m[p]&&))/
/^.$/d'
@alexlee-gk
alexlee-gk / configure_cuda_p70.md
Last active May 21, 2025 22:43
Use integrated graphics for display and NVIDIA GPU for CUDA on Ubuntu 14.04

This was tested on a ThinkPad P70 laptop with an Intel integrated graphics and an NVIDIA GPU:

lspci | egrep 'VGA|3D'
00:02.0 VGA compatible controller: Intel Corporation Device 191b (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GM204GLM [Quadro M3000M] (rev a1)

A reason to use the integrated graphics for display is if installing the NVIDIA drivers causes the display to stop working properly. In my case, Ubuntu would get stuck in a login loop after installing the NVIDIA drivers. This happened regardless if I installed the drivers from the "Additional Drivers" tab in "System Settings" or the ppa:graphics-drivers/ppa in the command-line.

@bryanbecker
bryanbecker / index.html
Created December 29, 2016 01:33
Lightdm Webkit 2 theme
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Pedro Penna - @pedropenna">
<title>Musfealle - Lightdm Webkit Greeter Theme</title>
@rfprod
rfprod / ArbitraryBaseConverter.markdown
Last active April 5, 2019 19:11
Arbitrary Base Converter

Arbitrary Base Converter

Converts between arbitrary bases defined as alphabets (should work for any arbitrary alphabet not only for predefined ones):

const Alphabet = {
  BINARY:        '01',
  OCTAL:         '01234567',
  DECIMAL:       '0123456789',
  HEXA_DECIMAL:  '0123456789abcdef',
 ALPHA_LOWER: 'abcdefghijklmnopqrstuvwxyz',
@JPvRiel
JPvRiel / bash_history_to_syslog.md
Last active May 2, 2025 15:06
Notes on (ab)using bash history to record commands to syslog

Logging bash history to syslog

Overview

Bash history was a convenience feature to help a user recall previous commands and not intended to meet any security requirements.

The Linux audit system (or alternate kernel level audit OS facility) is a more robust way to ensure user and process log events are recorded.

Security issues with bash history files and $BASH_COMMAND

@blackfalcon
blackfalcon / cliHacks-bash-git.md
Last active December 25, 2022 17:46
CLI hacks with BASH (and some GiT too)

As professionals we look to always optimize our workload. Through better processes and shortcuts we can eliminate unnecessarily repetitive tasks. One of the tools I use quite often is the Command Line Interface (CLI) and Git, and this is an area that we can automate quite extensively through some really simple to learn BASH hacks.

We all have tasks that we do endlessly, and there are tasks that we do independently and don't realize that there is a definitive pattern that we can embrace, put them to use in a simpler function and alter the results on a per use basis. It is through years of doing things the hard way that I have found some simple tricks that makes my life much easier to maintain.

What is BASH anyway?

Let's get this out of the way quickly first. In short, it is a Unix shell and command language most common on Linux and macOS and recently has made it's way to Windows as well. It is the common interface for running simple commands or other applications such as GiT, Curl, Ack, etc ...

If you

#!/bin/bash
# run this script form the vt220 to set up terminal width, keyboard shortcuts and other stuff.
stty rows 24 cols 132
export TERM=vt220
export LANG=en_GB.iso88591
# vim: `:set termencoding=iso88591`
echo -en "\eP1;1|17/5B\e\\" # Shift+F6 = [
@mutability
mutability / damage_analysis.py
Last active May 26, 2019 19:59
cdda ranged damage simulation
#!/usr/bin/env python3
import math, sys
from contextlib import closing
def normal_cdf(x, mu, sigma):
return 0.5 * (1 + math.erf((x - mu) / (sigma * math.sqrt(2))))
def rng_normal_cdf(x, hi):
mu = hi / 2.0