Skip to content

Instantly share code, notes, and snippets.

View styler3's full-sized avatar
🙂

Sam Tyler styler3

🙂
View GitHub Profile
@egelev
egelev / connect_bluetooth_headphones.sh
Last active July 27, 2024 21:16
Connect bluetooth headphones on Ubuntu 18.04
#!/usr/bin/env bash
function get_headphones_index() {
echo $(pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}')
}
function get_headphones_mac_address() {
local temp=$(pacmd list-cards | grep bluez_card -C20 | grep 'device.string' | cut -d' ' -f 3)
temp="${temp%\"}"
temp="${temp#\"}"
@sinclairtarget
sinclairtarget / fish.sim
Last active February 21, 2022 15:18
Simula Demonstration
Simulation Begin
! We will use this as input to Normal() below ;
Integer seed;
! Utility method for logging messages along with the current simulation
time ;
Procedure log(message); Text message; Begin
OutFix(Time, 2, 0);
OutText(": " & message);
OutImage;
@styler3
styler3 / chat-popups.txt
Last active July 8, 2024 18:09
uBlock Origin chat popup blocker
*.intercomcdn.com
*.tawk.to
*.livechatinc.com
*.olark.com
*.onesignal.com
*.freshdesk.com
*.zopim.com
*.freshchat.com
*.novocall.co
*.tidio.co
{
"Advanced Melee Weapons": {
"Cryopike - Advanced": {
"bulk": "2",
"cost": "34800",
"critical": "staggered",
"damage": "2d8",
"damagetype": "c",
"level": "12",
"sourcepage": "p.168",
@DiegoSalazar
DiegoSalazar / validate_credit_card.js
Last active April 24, 2024 12:51
Luhn algorithm in Javascript. Check valid credit card numbers
// Takes a credit card string value and returns true on valid number
function valid_credit_card(value) {
// Accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
let nCheck = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {
@ShirtlessKirk
ShirtlessKirk / luhn.js
Last active May 17, 2024 08:05
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,