This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import pathlib | |
for p in sorted(pathlib.Path('.').iterdir()): | |
if p.is_file(): | |
print(p) | |
p.touch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
n=$((1 + RANDOM % 2)) | |
if [[ "$n" == "1" ]]; then | |
str=$(shuf -n1 /usr/share/dict/american-english | cut -d$'\t' -f1 | tr '\n' ' ' | sed "s/'s//g") | |
else | |
str=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 4 | head -n 1) | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
date=$(($(date +%s%N)/1000000)) | |
odate=$([ -r /tmp/closer_click_date ] && cat /tmp/closer_click_date) | |
oid=$([ -r /tmp/closer_click_id ] && cat /tmp/closer_click_id) | |
sedGetValue='s/.*=\(.*\)/\1/' | |
id=$(xdotool getmouselocation --shell 2>/dev/null | grep WINDOW | sed "$sedGetValue") | |
class=$(xprop -id "$id" | grep WM_CLASS) | |
type="normal" | |
if [[ "$class" == *"Firefox"* ]]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Arguments: title message icon timeout mode | |
# If mode is 'update' it will update an existing notification with the same title | |
# Example usage: ~/scripts/notify.sh 'Audio Volume' ${vol} ~/scripts/music.jpg 2 update | |
awesome-client 'naughty = require("naughty") | |
local title = "'"$1"'" | |
local message = "'"$2"'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mutable variable | |
var a = "hello" | |
# Immutable variable | |
let a = "hello" | |
# Specify a type | |
var age: int | |
var name: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run with root privileges | |
product_id="D015" | |
product_id_o="d015" | |
vendor_id="12BD" | |
vendor_id_o="12bd" | |
cat - <<UDEV_RULESET > /etc/udev/rules.d/10-usb-snes.rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_export] | |
macro_rules! hashmap | |
{ | |
($( $key: expr => $val: expr ),*) => {{ | |
let mut map = ::std::collections::HashMap::new(); | |
$( map.insert($key, $val); )* | |
map | |
}} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn fac(n: u64) -> Vec<u64> | |
{ | |
let step = |x| (1 + ((x << 2) as i32) - (((x >> 1) as i32) << 1)) as u64; | |
let maxq: u64 = (n as f64).sqrt().floor() as u64; | |
let mut d = 1; | |
let mut q = if n % 2 == 0 {2} else {3}; | |
while q <= maxq && n % q != 0 | |
{ | |
q = step(d); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# This requires dropbox_uploader.sh for dropbox support | |
# You can create context menu entries in your DE or keyboard shortcuts for this | |
# Add your Imgur client ID | |
function upload_image | |
{ | |
client_id="yourImgurClientID" | |
link=$(curl -s --request POST --url https://api.imgur.com/3/image --header \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Wordz = function() | |
{ | |
const wordz = {} | |
wordz.words = | |
[ | |
"aardvark", "abacus", "abbey", "abdomen", "ability", "abolishment", "abroad", "abuse", | |
"accelerant", "accelerator", "access", "accident", "accommodation", "accompanist", "accordion", "account", | |
"accountant", "achiever", "acid", "acknowledgment", "acoustic", "acoustics", "acrylic", "act", | |
"action", "activity", "actor", "actress", "acupuncture", "ad", "adapter", "addiction", |