Skip to content

Instantly share code, notes, and snippets.

View drazulay's full-sized avatar
Ready to Rock

Daniel Azulay drazulay

Ready to Rock
View GitHub Profile
@drazulay
drazulay / DarkModeToggle.js
Created April 9, 2024 05:17
Toggle between light and dark color modes with React
import React, { useEffect, useState } from "react";
import { useMediaQuery } from "react-responsive";
export const DarkModeToggle = () => {
const [isDark, setIsDark] = useState(true);
useMediaQuery(
{
query: "(prefers-color-scheme: dark)",
},
@drazulay
drazulay / killphp.sh
Created April 4, 2024 17:53
Kill all PHP-FPM instances running
killphp () {
printf "This will kill all PHP-FPM instances running. Continue (y/N)? "
read -q
if [[ $? -eq 0 ]]
then
for pid in $(ps aux | grep php-fpm | grep -v color | tr -s " " | cut -d" " -f2)
do
sudo kill -9 $pid
done
echo "\nall instances killed"
@drazulay
drazulay / wekker
Last active September 7, 2023 08:43
A terminal alias implementing an alarm clock.
# Usage: wekker 21:04 /path/to/audiofile.mp3.
# Add this to your ~/.profile or wherever you store your aliases.
# You could run it from crontab.
alias wekker='_wekker(){ printf "you will be woken up at %s with audio file %s\n" "$1" "$2"; while [ 1 ]; do; date "+%H:%M" | grep -q "$1"; [[ $? -eq 0 ]] && open -a VLC "$2" && break || sleep 1; done; }; _wekker'
@drazulay
drazulay / install.sh
Last active April 2, 2022 08:59
OS X Developer onboarding script
#! /usr/bin/env bash
################################
# Onboarding script for OS X
# Installs a bunch of software,
# and optionally an extra bunch
# of other software - yay, more
# bytezz! Also does some config-
# foo like a small zsh and os x
# polish.

Keybase proof

I hereby claim:

  • I am drazulay on github.
  • I am drazulay (https://keybase.io/drazulay) on keybase.
  • I have a public key ASB-BEDWcWetK2gSV7pWOd91P41dIqpZRZGgnRUV4C5-wAo

To claim this, I am signing this object: