Skip to content

Instantly share code, notes, and snippets.

View oxalorg's full-sized avatar
:shipit:
Always Be Coding

Mitesh oxalorg

:shipit:
Always Be Coding
View GitHub Profile
@oxalorg
oxalorg / Example log
Created July 31, 2023 06:20 — forked from dspezia/Example log
Assessing pending activity of a Redis server
> ~/tcp_redis_monitor.py 6379
Timestamp Nb TX bytes RX bytes TX RMA RX RMA
1333983822.943 1 0 0 0.000 0.000
1333983823.193 1 0 0 0.000 0.000
1333983824.194 1 0 0 0.000 0.000
1333983825.195 1 0 0 0.000 0.000
1333983826.196 1 0 0 0.000 0.000
(ns poly
(:require
[clojure.string :as str]))
;; =====================================================
;; what is a good way to do polymorphism on an example like this:
;; =====================================================
(defn transform-messages [messages]
(map #(update % :text str/upper-case) messages))
@oxalorg
oxalorg / auto_ssh_keys
Last active February 12, 2021 16:41 — forked from plexus/auto_ssh_keys
#!/usr/bin/env bash
# Import SSH keys from Github to ~/.ssh/authorize_keys for all members of a
# given Github organization.
#
# Will replace authorized_keys, if it looks like authorized_keys was not
# previously created by this script then a backup copy is made.
#
# Depends on jq, will download it if not available (assumes Linux) to ~/bin/jq
#
#!/bin/sh
zcfg ()
{
local URL;
if [[ $# -lt 1 ]]; then
defaults read ZoomChat conf.webserver;
else
defaults write ZoomChat com.zoom.client.zclist "";
case $1 in
@oxalorg
oxalorg / emacs lock buffer to window with tabbar
Created December 31, 2020 06:39 — forked from ShingoFukuyama/emacs lock buffer to window with tabbar
Stick/Lock buffer to window, compatible with tabbar.el. Emacs
;; http://lists.gnu.org/archive/html/help-gnu-emacs/2007-05/msg00975.html
(defvar sticky-buffer-previous-header-line-format)
(define-minor-mode sticky-buffer-mode
"Make the current window always display this buffer."
nil " sticky" nil
(if sticky-buffer-mode
(progn
(set (make-local-variable 'sticky-buffer-previous-header-line-format)
@oxalorg
oxalorg / script-template.sh
Created December 15, 2020 08:31 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
trap cleanup SIGINT SIGTERM ERR EXIT
usage() {
cat <<EOF
(ns repl.reactions
(:require [clojurians-log.application :as app]
[clojurians-log.slack-api :as slack]
[clojurians-log.db.queries :as q]
[clojurians-log.db.import :as import]
[clojurians-log.data :as data]
[clojure.java.io :as io]
[clojurians-log.datomic :as d]
[clojure.tools.reader.edn :as edn]
[clojure.string :as str]
@oxalorg
oxalorg / views.py
Created August 24, 2020 06:54 — forked from alee/views.py
Django Discourse SSO endpoint adapted from https://meta.discourse.org/t/sso-example-for-django/14258 - depends on settings.py DISCOURSE_BASE_URL and DISCOURSE_SSO_SECRET
import base64
import hmac
import hashlib
from urllib import parse
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseBadRequest, HttpResponseRedirect
from django.conf import settings
@login_required
@oxalorg
oxalorg / Build.xml
Created January 9, 2020 04:24 — forked from NickCraver/Build.xml
Stack Overflow Build Reference Docs
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="PrepareStaticContent" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Passed in Parameters -->
<configuration></configuration>
<workingDir></workingDir>
<buildNumber></buildNumber>
<buildViews>false</buildViews>
<minifyJs>true</minifyJs>
<TargetsDirectory></TargetsDirectory>
@oxalorg
oxalorg / yt-embed.js
Created March 30, 2017 06:58 — forked from do18/yt-embed.js
If you are concerned about web site performance, you probably noticed that embedded YouTube iframes are costly. Instead of iframes, you may embed images that link to the respective videos, and make these links replace themselves with iframes when clicked. (IE 9+ because of getElementsByClassName.)
/*jshint maxlen: 79 */
var MYSITE = MYSITE || {};
/**
* Make YouTube links with .yt-embed replace themselves with YouTube iframes
* when clicked. The first child element is assumed to be the img element
* holding the poster frame. The YouTube URL must contain the "v" parameter,
* but no further parameters. The data-yt-options attribute may hold iframe
* URL parameters.