Skip to content

Instantly share code, notes, and snippets.

View rbtylee's full-sized avatar
🏠
Working from home

Robert Wiley rbtylee

🏠
Working from home
View GitHub Profile
@matthen
matthen / hello_world.py
Last active April 26, 2024 12:17
Hello world in python, using genetic algorithm
"""Hello world, with a genetic algorithm.
https://twitter.com/matthen2/status/1769368467067621791
"""
import random
import time
from dataclasses import dataclass
from itertools import chain
from typing import Iterable, List
@a1k0n
a1k0n / donut.c
Created October 23, 2023 04:03
donut shift and add only
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#define debug(...)
//#define debug printf
// torus radii and distance from camera
@lbonanomi
lbonanomi / blockCurlPipeBash.sh
Created August 5, 2021 01:48
BASH_ENV script to nag users about piping curl calls into bash
# The construction `curl http://example.com/shellscript.sh | bash` fills me with boiling rage
#
# export BASH_ENV=/usr/local/bin/blockCurlPipeBash.sh
if [[ $(grep "$(cat /proc/$$/cmdline | tr '\000' "\n" | tail -1)$" /etc/shells) ]]
then
# |- In case of non-interactive session -| |- dump PID table to find all sibling PIDs -|
#
echo $- | grep -qv i && ps awwwx -ocmd,pid,ppid | grep "$(ps -p $$ -o ppid | tail -1)$" | while read p
do
@tazihad
tazihad / youtube-dl-cheat-sheet
Last active November 8, 2023 21:05
youtube-dl cheat sheet.
*** Best video in mp4 format [if available] in 1080p ***
$ youtube-dl -f 'bestvideo[height<=1080 && ext=mp4]+bestaudio' https://www.youtube.com/watch?v=LXb3EKWsInQ
*** For ease of use make alias for this command ***
$ alias yt="youtube-dl -f 'bestvideo[ext=mp4][height<=1200]+bestaudio[ext=m4a]' -o '%(title)s'"
Youtube-dl Tutorial With Examples
Here, I have compiled most commonly used Youtube-dl commands to download a video or playlist from YouTube.
@dk-crazydiv
dk-crazydiv / Setup instructiRons.md
Created March 15, 2020 15:01
Display a collection of quotes in notification style on desktop using a keyboard shorcut

To run:

python gtk-desktop-quote-display.py

If facing an error: No module named GI in virtualenv, try this:

pip install vext

pip install vext.gi
@TerminalRootTV
TerminalRootTV / git-dir.sh
Created September 21, 2019 17:25
Clone Only a Git Subdirectory
#!/bin/bash
# author: Marcos Oliveira <terminalroot.com.br>
# describe: Clone Only a Git Subdirectory
# version: 1.0
# license: GNU GPLv3
if [[ "$(echo $LANG | cut -c 1-2)" != "pt" ]]; then
declare -x l=( "usage"
"Use this flag to inform the REPOSITORY, this option is not optional."
@santuari
santuari / index.sh
Created June 27, 2018 14:22
Script to index the Ubuntu repository within a cdrom. This script may be used to add packages to a cdrom.
#!/bin/bash
#Variable to customize
GPG_NAME=key_id
GPG_PATH_PW=path_to_password
#Main is the default repo component, I added extras. It means that my deb in pool/extras will be added
REPONAME=(main extras)
ORIGIN="my company"
LABEL="my mirror"
@meets2tarun
meets2tarun / chrome.json
Created May 22, 2017 15:36
Copy the file in /etc/chromium-browser/policies/managed and make required changes in chromium-browser
// Policy template for Linux.
// Uncomment the policies you wish to activate and change their values to
// something useful for your case. The provided values are for reference only
// and do not provide meaningful defaults!
{
// Cross-origin HTTP Basic Auth prompts
//-------------------------------------------------------------------------
// Controls whether third-party sub-content on a page is allowed to pop-up an
// HTTP Basic Auth dialog box. Typically this is disabled as a phishing
// defense. If this policy is not set, this is disabled and third-party sub-
@ssledz
ssledz / bash-cheat-sheet
Created May 21, 2016 14:36
BASH Cheat Sheet
B A S H C H E A T S H E E T
to page output forward (only): command filename | more
to page output forward & back: command filename | less
to print a dataset: lp datasetname (-d printerid) (-o landscape)
USE OF QUOTATION MARKS
echo "$varname" = echo The value of \$varname is \"$varname\"
= echo "The value of \$varname is \"$varname\"."
$fred='Four spaces between these words.'