This file contains hidden or 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
# Often times I just want to run previous commands inside tmux sessions and keep a tab on what I was working just before | |
if [ -n "$TMUX" ]; then | |
# Get the tmux session name | |
session_name=$(tmux display-message -p '#S') | |
export HISTFILE="$HOME/.zsh_history_tmux_${session_name}" | |
fi |
This file contains hidden or 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
design a scheduler: | |
- schedule for a given time input->(fn, time) | |
- cron like schedule ( every night at 12:00 AM) | |
Functionality: | |
- configure |
This file contains hidden or 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
panic(cpu 0 caller 0xfffffff0232dbf60): x86 CPU CATERR detected | |
Debugger message: panic | |
Memory ID: 0x6 | |
OS release type: User | |
OS version: 21P3049 | |
macOS version: 23D60 | |
Kernel version: Darwin Kernel Version 23.3.0: Wed Dec 20 22:31:16 PST 2023; root:xnu-10002.81.5~10/RELEASE_ARM64_T8010 | |
KernelCache UUID: 5055C553638BB2B9A72F9B074650402D | |
Kernel UUID: 98C51133-18A2-37CC-8054-0C2A5A0CC992 | |
Boot session UUID: 80B9AC50-63B4-46D2-919C-AE0F9CFBC614 |
This file contains hidden or 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
// Communication Sequential Process (CSP) - Tony Hoare | |
// Finding Prime numbers using sieve in parallel | |
package main | |
import "fmt" | |
func main() { | |
src := make(chan int) |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
amqp "github.com/rabbitmq/amqp091-go" | |
) | |
func failOnError(err error, msg string) { |
This file contains hidden or 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
for log in /var/log/{dmesg,syslog,kern.log}; do | |
echo "${log} :" | |
sed -e 's/\[[^]]\+\]//' -e 's/.*[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}//' ${log} \ | |
| sort | uniq -c | sort -hr | head -10 | |
done |
This file contains hidden or 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/python | |
import requests as r | |
import json | |
import sys | |
web_hook='' # slack web hook url | |
def send_message(msg): | |
payload={'text':msg} | |
one_man_army_hook=webhook | |
headers= {'Content-type': 'application/json'} |
This file contains hidden or 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
files=$(ls | awk '{print $1}') | |
serial=1 | |
for fn in $files; do | |
echo "the next file is $fn" | |
extension="${fn##*.}" | |
filename="${fn%.*}" | |
echo "serial is $serial" | |
echo "filename is $filename and extension is $extension" | |
newfilename=$filename$serial | |
echo "mv $filename.$extension $newfilename.$extension" |
This file contains hidden or 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
wget -r -P ./pdfs -A pdf /web_url_containing_links/ |
This file contains hidden or 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 | |
server="$1" | |
lines=100 | |
echo server is $server | |
if [ "$#" -eq 2 ]; then | |
lines="$2" | |
fi | |
echo lines are $lines | |
logfile=/root/logs/staging$server/logfile.log | |
echo Opening $logfile |
NewerOlder