Skip to content

Instantly share code, notes, and snippets.

View rrbutani's full-sized avatar
🐢
slowly but surely

Rahul Butani rrbutani

🐢
slowly but surely
  • 03:44 (UTC -08:00)
View GitHub Profile
@rrbutani
rrbutani / backup.sh
Created May 16, 2016 22:13
Backup Script
#/bin/bash
touch /tmp/bkd
#!/bin/bash
# Universal:
cd ~/
#source .bashrc
./install.sh 172.31.23.76
# Slave:
##start-slave
#cd ~/druid/druid-0.9.0/ && bash start-historical-hadoop.sh && cd -
# Run every 0th, 30th second:
while true; do while [[ "$(date +%S)" -ne "30" && "$(date +%S)" -ne "0" ]]; do date +%S; sleep 1; done; echo "hi!"; while [[ "$(date +%S)" -eq 0 || "$(date +%S)" -eq 30 ]]; do : ; done; done
# Dump energy-rate every ~20 seconds (drifts)
while true; do upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep energy-rate | cut -d " " -f 14 | tee batt_log_discharge-05-30-2017.txt; sleep 20; done
@rrbutani
rrbutani / Misc
Last active June 20, 2017 19:59
middleman.sh
count=0; for i in *.jpg; do a=(${i//2017/ }); a=$(basename ${a[1]#0} .jpg); if [[ a -lt 100801 ]]; then echo ${a}; ((count++)); fi; done; echo ${count}
ffmpeg -r 30 -i %*.jpg -s hd1080 -vcodec libx264 -vframes ${count} time-lapse.mp4
@rrbutani
rrbutani / run.sh
Last active March 27, 2019 07:20
🤫
#!/usr/bin/env bash
touch /tmp/a
touch /tmp/b
touch /tmp/c
touch /tmp/d
@rrbutani
rrbutani / <>
Last active January 15, 2020 02:59
/usr/share/openmediavault/mkconf `ifconfig` patch
#!/usr/bin/env bash
IFACE=__
# Existing:
d_get_ipv4_definition()
{
ifconfig "$1" | grep "inet addr:"
}
@rrbutani
rrbutani / routers.sh
Last active August 18, 2020 03:32
Routers
#!/usr/bin/env bash
# Alright so, this hotel decided to put up separate SSIDs for each room. This
# is kind of annoying since we've been moved 3 times and since it's a large
# property. T-Mobile also doesn't have coverage here so the moment we step out
# of our rooms we can't make or receive calls even though we're still in range
# of the hotel's wifi networks.
#
# Also interesting is that the hotel decided to use a few models of router (as
# far as I can tell they're all cable + wifi router devices) *and* decided to
#!/usr/bin/env bash
# $1 : battery code
try_battery_code() {
raw=$(curl -s "https://duckduckgo.com/html" \
-H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86; rv:49.0) Gecko/20100101 Firefox/49.0' \
-H 'Accept-Language: en-US,en;q=0.5' \
--compressed -H 'Referer: https://duckduckgo.com/' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Connection: keep-alive' \
@rrbutani
rrbutani / notes.md
Last active February 9, 2020 09:14
nvidia-390 w/5.3.0-28 on hera on an xps 9560

since i don't have a blog, i'm going to dump here:

  • /lib/modules/<kernel version>/updates/dkms isn't what dkms uses anymore for, at least for ubuntu provided HWE and other patched kernels; instead it's /lib/modules/<kernel version>/extras so make your symlinks so that X and bumblebee and friends don't flip out
  • you can use the graphics ppa (ppa:graphics-drivers/ppa or just the stock ubuntu contrib/non-free bionic ppas)
  • install: bbswitch-dkms prime-select acpi-call-dkms nvidia-390 bumblebee bumblebee-nvidia (if you don't install this one you'll suffer like me) and (crucially!) your linux kernel's headers! (i.e.: linux-headers-generic-hwe-18.04-edge or linux-headers-5.3.0-26-generic) (note: install your headers before you install the other things or if you don't go run dkms manually)
  • nvidia drivers are no longer symlinked to /usr/lib/nvidia-current so change /etc/bumblebee/xorg.conf.nvidia and /etc/bumbleebee/bumblee.conf's contents to match ([this](https://github.com/Bumb
#!/usr/bin/env bash
# Go to the directory where you want to install all these things:
# - i.e.: `mkdir -p /dev/shm/__ && cd !$`
#
# Copy this script into that dir:
# - i.e.: `cp <path/to/script> !$`
#
# And then source this script:
# - i.e.: `source sourceme`