Skip to content

Instantly share code, notes, and snippets.

@ckabalan
ckabalan / best_bash_history.sh
Last active May 1, 2024 17:29
The Best Bash History Settings Ever
# /etc/profile.d/best_bash_history.sh
# Save 5,000 lines of history in memory
HISTSIZE=10000
# Save 2,000,000 lines of history to disk (will have to grep ~/.bash_history for full listing)
HISTFILESIZE=2000000
# Append to history instead of overwrite
shopt -s histappend
# Ignore redundant or space commands
HISTCONTROL=ignoreboth
# Ignore more
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 1, 2024 17:28
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@hhkaos
hhkaos / script.md
Last active May 1, 2024 17:28
From Zero to Newbie with ArcGIS API for JS and TypeScript

From zero to newbie with ArcGIS API for JS and TS.

Hello TypeScript demo

Initialize a typescript project:

npm init -y
npm i typescript --save-dev
@CreatureSurvive
CreatureSurvive / HeaderAttribute.cs
Last active May 1, 2024 17:26
Better inspector headers in Unity
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
//using CS;
//[System.Serializable]
//public class HeaderExampleClass
//{
// [Header("My Fields", 3)]
@fhferreira
fhferreira / RetryAllFailedJobsCommand.php
Created December 8, 2023 04:01 — forked from ulcuber/RetryAllFailedJobsCommand.php
Laravel Horizon. Retry all of the failed jobs like one in the horizon dashboard
<?php
namespace App\Console\Commands\Horizon;
use Illuminate\Console\Command;
use Illuminate\Queue\Failed\FailedJobProviderInterface;
use Laravel\Horizon\Contracts\JobRepository;
use Laravel\Horizon\Jobs\RetryFailedJob;
class RetryAllFailedJobsCommand extends Command
@spencer741
spencer741 / VM_RDP_Manager.ps1
Last active May 1, 2024 17:25
PowerShell Script - Azure VM Start and Stop, with RDP contingency (single connection).
# Self-elevate the script if required
"`Self Elevating...`n"
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
}
@portellam
portellam / README.md
Last active May 1, 2024 17:26
Bash Explained: "Classes", References, and Inherited Variables

Bash Explained: "Classes", References, and Inherited Variables

(In)famous developer and devout Christian, Terry Davis, has said an idiot admires complexity, a genius admires simplicity.

When you see my code examples and my code-style in Bash, you may think I'm a bit of both.

Table of Contents

@BenHurMartins
BenHurMartins / index.js
Last active May 1, 2024 17:22
Double or Single Tap
import { useEffect, useState } from "react";
import { Pressable, StyleSheet, Text, View } from "react-native";
let timer = null;
const TIMEOUT = 500
const debounce = (onSingle, onDouble) => {
if (timer) {
clearTimeout(timer);
timer = null;
onDouble();
@qskwood
qskwood / wget-warc-generator
Last active May 1, 2024 17:21
This script uses wget to generate a WARC that can be read by a player like OpenWayback and places it into a directory. It also handles creation and use of CDX indexes for de-duplication.
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Must only have two arguments, the URL and the collection" >&2
exit 1
fi
if [[ ! -d "/var/spool/openwayback/files2/${2}" ]]; then
mkdir "/var/spool/openwayback/files2/${2}"
fi
@dhh
dhh / linux-setup.sh
Last active May 1, 2024 17:20
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils