Skip to content

Instantly share code, notes, and snippets.

@rygorous
rygorous / iggy_focus.cpp
Created October 14, 2013 19:46
Iggy focus handling
enum FocusDir
{
DIR_W,
DIR_E,
DIR_N,
DIR_S
};
static FocusDir get_quadrant(float dx, float dy)
{
@chrismccord
chrismccord / dev.exs
Created May 8, 2024 20:06
Live Reload LiveView notify
config :wps, WPSWeb.Endpoint,
live_reload: [
notify: [
live_view: [
~r"lib/wps_web/core_components.ex$",
~r"lib/wps_web/(live|components)/.*(ex|heex)$"
]
],
patterns: [
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
@BretFisher
BretFisher / repair-windows-update.bat
Last active May 9, 2024 04:16
Reset Windows Update components RE: KB971058
@echo off
REM Automation of Steps to Reset Windows Updates
REM Tested on Server 2012 R2, likely works on everything Win7/2008R2 and up
REM by Bret Fisher bret@bretfisher.com
REM also find this info and more in a blog article at http://www.fishbrains.com/2015/01/29/untitled/
REM Origional Steps (identical to this): http://support.microsoft.com/kb/971058
REM This file Copyright MIT License
REM Stop Services
@kupietools
kupietools / Docker Desktop v 4.0.0 thru 4.22.1 direct download links
Last active May 9, 2024 04:12
List of Direct Download links for Docker Desktop from version 4.0.0 released 2021-08-31 thru 4.22.1 released 2023-08-24, as archived on archive.org
#!/bin/bash
# This script requires docker cli built from master since released version does not support riscv64 manifest annotation
# 1 可以使用binfmt跨平台构建,不需要在native上构建;go版本不低于1.16
# 确定 k8s 版本
# git reset --hard v1.21.1
# 确定配套的 pause 版本
# cat ./kubernetes/build/pause/Makefile | grep "TAG ="
#
# 2 k8s代码的修改:
@hlorand
hlorand / RaspberryPiVideoRecord.sh
Created June 24, 2017 18:37
Video recording and streaming script for Raspberry Pi + Pi Camera
#!/bin/bash
#
# Video recording script for Raspberry Pi. Set bitrate and recording time below
#
# To autostart this script after login, edit /etc/xdg/lxsession/LXDE-pi/autostart and add the following line BEFORE "@xsreensaver":
#
# sh ./RaspberryPiVideoRecord.sh
#
# To convert the output .h264 file to mp4:
#
@ndavison
ndavison / hbh-header-abuse-test.py
Last active May 9, 2024 04:10
Attempts to find hop-by-hop header abuse potential against the provided URL.
# github.com/ndavison
import requests
import random
import string
from argparse import ArgumentParser
parser = ArgumentParser(description="Attempts to find hop-by-hop header abuse potential against the provided URL.")
parser.add_argument("-u", "--url", help="URL to target (without query string)")
const int mod = 998244353;
using lint = long long;
lint ipow(lint x, lint p){
lint ret = 1, piv = x;
while(p){
if(p & 1) ret = ret * piv % mod;
piv = piv * piv % mod;
p >>= 1;
}
return ret;
@alexng353
alexng353 / nextjs.yml
Last active May 9, 2024 04:08
Next JS build test GitHub action
# Sample workflow for building and deploying a Next.js site to GitHub Pages
#
# To get started with Next.js see: https://nextjs.org/docs/getting-started
#
name: Check NextJs build
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
@MuhsinFatih
MuhsinFatih / pythondoneright.md
Last active May 9, 2024 04:07
How to recover from messed up python installation on mac, and never have to mess with apple's shitty python confusion factory

I am assuming you are here because like me, you installed a bazillion different python interpreters on mac and the whole thing is a spagetti. Today, I finally fixed my python installation. Whatever I install for python2 or python3 using pip JUST.WORKS.. My god! finally.

What the hell?

Here is what I had messed up, which you also probably did:

  • I had too many different python interpreters
  • Too many different symlinks which I lost track of
  • almost no package I installed with pip worked without a headache
  • any attempt to fix using online resources made it worse.